View previous topic :: View next topic |
Author |
Message |
Paolo Guest
|
problem with ADC port on 16F876 |
Posted: Tue Jan 03, 2006 12:58 pm |
|
|
Hallo ALL there!!
I Have a problem with the 16F876 pic.
When I read the AN0 analog input which is driven by a 1K potentiometer I can only see a value from 0 to 255 (the variable is of type int). The value I see goes from 0 to 255 3 times when I turn the potentiometer till the end. I use CCS C ver 3.26 and I use the read_adc function and it seems return only the LSB of the 10 bit value. Maybe I must use another function?
I have this device
#device *=16 ADC=10 ICD=TRUE
or
#device *=16 ADC=16 ICD=TRUE
Anyone can help me???
THANK YOU VERY MUCH
Paolo |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Paolo Guest
|
I have found the solution |
Posted: Tue Jan 03, 2006 1:08 pm |
|
|
I was using an int variable but I must use an int16 type!
THANKS TO ALL |
|
|
|