1. bilal sheikh

    Thread Starter New Member

    Jan 21, 2015
    22
    0
    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.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    You can convert 10-bit values to 8-bit values by rounding or truncation. Is that what you want to do?
     
    bilal sheikh likes this.
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    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.
     
    bilal sheikh likes this.
  4. bilal sheikh

    Thread Starter New Member

    Jan 21, 2015
    22
    0
    YES SIR, ITS ALL THAT I WANT. THANK YOU FOR HELPING ME OUT.
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    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.
     
Loading...