PIC18f4431 ADC

Thread Starter

bilal sheikh

Joined Jan 21, 2015
22
hello all,
i want to use 8bit ADC instead of 10bit ADC (which is by default present in MCU PIC18f4431).
any idea ?
i cant find anything about this in datasheet.
thanks in anticipation.
 

tshuck

Joined Oct 18, 2012
3,534
The ADC returns a 10-bit result no matter whether you want 8 or 10. If you want 8 bits, simply use the most significant 8 bits.

If you were to simply left justify the results, ADRESH would contain your 8-bit result.
 

Papabravo

Joined Feb 24, 2006
21,225
Your best strategy is to ask the processor to give you the result in Left-Justified form. This will put the most significant 8 bits in the register called ADRESH. If the result is 255 (0xFF) then dont bother rounding becaust that will cause an overflow. If the result is less than 255 then examine the contents of ADRESL. If the result is greater than or equal to 128 ( 0x80) then add 1 to the high order result.
 
Top