Well, in that case with 8 bit ADC, variable mon should be a BYTE rather than a WORD.
Your ADC range for 0-5v is an ADC reading of 0-255 where 255=5v.
So 2 volts will be 2/5ths of 255 namely 102...
So the IF statement then becomes IF mon > 102 THEN...
The decision to use 8-bit or 10-bit ADC is simply a matter of precision, and you chose whether you need steps of 1/255 or 1/1024 for the ADC span that you are using.




Bookmarks