ADC bits

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

Moderators: Benj, Mods

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

ADC bits

Postby a7med600 » Fri Dec 14, 2012 5:01 pm

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: 14453
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4515 times
Been thanked: 4192 times
Contact:

Re: ADC bits

Postby Benj » Fri Dec 14, 2012 5:35 pm

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

Postby a7med600 » Sat Dec 15, 2012 11:39 am

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.