ADC bits

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
a7med600
Posts: 2
Joined: Fri Dec 14, 2012 4:47 pm
Contact:

ADC bits

Post 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 .

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ADC bits

Post 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.

a7med600
Posts: 2
Joined: Fri Dec 14, 2012 4:47 pm
Contact:

Re: ADC bits

Post 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.

Post Reply