877A AtoD config problem?
Hi,
Using the X1-demo board and a 877A chip. All I want to do is config portA so I can use the pins, An2, An4 An5 to read the voltage from and accelerometer. I started with the A2D8.bas demo code and all works to read pin An2, the problem happens when I try to config the A/D port config control bits from:
ANDCON1 = %1000 0010 ' An0-An4 configed for Analog Input
to
ANDCON1 = %1000 0000 ' An0-An7 configed for Analog Input
or
ANDCON1 = %1000 1001 ' An0-An5 configed for Analog Input
I'm only trying to read An2 but ,my display is not showing anything but sometimes flashes, any ideas?
oh, ADCON0 is:
ADCON0 = %11010001 ' Configure and turn on A/D Module
thanks
t
Seems simple, really just use
I am surprised that your program is compiling!
Quote:
Originally Posted by
ttease
Hi,
Using the X1-demo board and a 877A chip. All I want to do is config portA so I can use the pins, An2, An4 An5 to read the voltage from and accelerometer. I started with the A2D8.bas demo code and all works to read pin An2, the problem happens when I try to config the A/D port config control bits from:
ANDCON1 = %1000 0010 ' An0-An4 configed for Analog Input
to
ANDCON1 = %1000 0000 ' An0-An7 configed for Analog Input
or
ANDCON1 = %1000 1001 ' An0-An5 configed for Analog Input
I'm only trying to read An2 but ,my display is not showing anything but sometimes flashes, any ideas?
oh, ADCON0 is:
ADCON0 = %11010001 ' Configure and turn on A/D Module
thanks
t
Seems simple, really just use
You also need to set your data direction register TRISA as inputs and disable the comparator. Although the POR values should do, it is better to configure manually.