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


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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…