PDA

View Full Version : Problem with AD inputs at PIC16f873a



wurm
- 24th April 2008, 21:40
Hi,

I have a problem with a Pic16f873a.
I´m using 4 of the 5 analog to digital converts. Every AD port is with a resistor pulled down.
On Port c I have 4 outputs with LEDs.
As you can see on Beispiel1.bas I read ad channel 0 to 3 and when there is a value bigger than 0 the Led on the output changes to high.
This works for all of the 4 channels.

Now I`ve changed the program (see Beispiel2.bas)
On AD channel 0 the Led only get high when on the input a signal with 2.5V exists.
Now, when I put a signal bigger than 0V on any of the 4 AD inputs, all of the 4 output Led gets high.
I can´t understand this. I´ve tried various ADCON0 and ADCON1 and Sample-times without any other result.

Does somebody know, what here is wrong?

Best regards,
Thorsten Wurm

mackrackit
- 24th April 2008, 22:10
Maybe


IF Messwert1 > 120 then check
check:
IF Messwert1 < 130 then

high Alarm1

wurm
- 25th April 2008, 08:45
hi,

I´ve trie this, but the problem is still the same.
I think the main program is correct and there
only can be some errors in the configuration and the adcons.

Best regards,
Thorsten Wurm

mackrackit
- 25th April 2008, 10:01
You might be correct, I have not looked at the data sheet for that chip lately.

Read this article. http://www.rentron.com/PIC12C67XAD.htm

It is for a different chip but it explains how to set up the ADC much better than I can.