Quote:
|
Originally Posted by Lac
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.