I forgot to mention that I tested pins 0-3 on PORT A as outputs and they
worked fine.
I have also tried connecting an LED to the output of the comparator where it
would usually be connected to the Atmel and it went on/off as expected.
Jack.
----- Original Message -----
From: Jack Valmadre
To: AVR-Chat@yahoogroups.com
Sent: Saturday, August 28, 2004 7:39 AM
Subject: [AVR-Chat] PORTA input problems
Hi,
I have the outputs of a quad comparator (LM339) connected to PORT A of an
AT90S8535 on pins 0-3.
I can read pins 0 and 1 fine, but 2 and 3 are constantly read as low. I
tried moving this to pins 4-7 and the opposite happened, so I could read
from pins 6 and 7 but not 4 and 5. I moved the whole thing to PORT C and it
worked fine, but I cannot do this permanently as all my other ports are in
use. I need to use all 8 pins of PORT A and I don't want to split the
connector. The comparator outputs are pulled high by an 8.2k resistor.
I have AVCC and AREF connected to the +5V supply and AGND is connected to
0V.
I am not using the ADC but I will have to soon.
Has anyone seen this before or know how to fix it?
I have attached my program below in case it is any help.
Thanks,
Jack
#include <avr/io.h>
#define green (1<<PD1)
#define blue (1<<PD0)
#define red ((1<<PD1)|(1<<PD0))
#define white 0
int main(void) {
unsigned char sensors;
DDRA = 0x00;
DDRB = 0x00;
DDRC = 0x00;
DDRD = 0xFF;
for(;;) {
sensors = PINA & 0x0F;
if( (sensors & (1<<0)) || (sensors & (1<<1)) ) {
if( (sensors & (1<<2)) || (sensors & (1<<3)) ) {
PORTD = green;
} else {
PORTD = blue;
}
} else {
PORTD = red;
}
}
}
Yahoo! Groups Sponsor
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.Message
Re: [AVR-Chat] PORTA input problems
2004-08-27 by Jack Valmadre
Attachments
- No local attachments were found for this message.