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 .
ADC bits
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ADC bits
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.
i made the variable integer, and then i divided it to reduce the number of bits,
thanks.