I'll have to look at the ADCON1 register. I think there is some insight for me there.
The initial value for bvoltage is set higher than any 10 bit reading can be so the flag is not triggered on the first cycle.
It could just as easily be 1024, but it's a 10 bit value stored in a 16 bit word var, so I can use a higher number.
bvoltage is the last reading stored for X number of cycles to be compared to the current value which is avoltage.
If no branch condition is met, then the current value becomes the last value for comparison the next time.




Bookmarks