Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to actually use the value generated by A2D conversion?

Status
Not open for further replies.

Lac

New Member
Hi there!

After reading Nigels superb tutorial on analog to digital conversion using the 16F876, I have finaly understood how to setup A2D, but what I dont understand yet is how I can actually use that digital value to do something, like putting a pin high when the digital value reaches f.ex. 500, and go low when it is under 500. Would be neat to be able to turn a fan on and off by connecting a thermistor to the A2D.

Anyone know how to do this? Boolean? Code examples would be greatly appriciated. thanks.
 
Re: How to actually use the value generated by A2D conversio

Lac said:
Hi there!

After reading Nigels superb tutorial on analog to digital conversion using the 16F876, I have finaly understood how to setup A2D, but what I dont understand yet is how I can actually use that digital value to do something, like putting a pin high when the digital value reaches f.ex. 500, and go low when it is under 500. Would be neat to be able to turn a fan on and off by connecting a thermistor to the A2D.

Anyone know how to do this? Boolean? Code examples would be greatly appriciated. thanks.

You need to compare values, if you check on the PICList there are various examples, either 8 bit or 16 bit for such functions as 'equal to', 'greater than', 'less than' etc.

Basically you use either SUBxx or XORxx and check the FLAGS register.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top