Page 1 of 1

ADC bits

Posted: Fri Dec 14, 2012 5:01 pm
by a7med600
Hi I am new to Flowcode word ,
I am programming PIC to to generate numbers on 7 segment,
when i assign the ADC o/p to port B i can't use all the 10 bits that generated from ADC !! just 8 ,
so how i can send the other two bit to port c for example?
or how i can change the generated bits from ADC from 10 bits to 8 (i am using pic16f877) ?
thanks in advanced .

Re: ADC bits

Posted: Fri Dec 14, 2012 5:35 pm
by Benj
Hello,

The read as byte component macro automatically scales the value to be 8-bit.

If you want to display the whole 10-bit resolution then you need to use a 16-bit variable to store the value and then output to byte variables or ports like this.

lo_byte = int_var
hi_byte = int_var >> 8

Hope this helps.

Re: ADC bits

Posted: Sat Dec 15, 2012 11:39 am
by a7med600
thank you i have solve it as you mention,
i made the variable integer, and then i divided it to reduce the number of bits,
thanks.