PDA

View Full Version : 877A AtoD config problem?



ttease
- 1st April 2007, 12:31
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

sougata
- 1st April 2007, 14:49
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.

ttease
- 1st April 2007, 16:57
Thanks for the reply, I only included the code I figured might be giving me the problem. My Bad!

After re-reading the correct DS, I figued out that RA4 cannot be configured as an Analog Input.

I'm using the 877A to prototype some code that will run on a P18F4431. All pins on Port A of the 4431 can be Analogs, so I figured.....

Note to self:RTCFDS- Read the correct F* data sheet!

thanks

t