[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Heli reding inputs from PORTC
From: |
Gavin Jackson |
Subject: |
RE: [avr-gcc-list] Heli reding inputs from PORTC |
Date: |
Tue, 03 Feb 2004 11:38:38 +1300 |
The ports are made up of three registers, a direction register DDRA, an
output register PORTA and an input register PINA. Try Using PINC instead of
PORTC when reading back the value.
-----Original Message-----
From: Helix [mailto:address@hidden
Sent: Tuesday, 3 February 2004 11:32 a.m.
To: address@hidden
Subject: [avr-gcc-list] Heli reding inputs from PORTC
Hello,
I am trying to use an input, but seems thatI'm doing something wrong here. I
tried to turn on some ouput (where I connected a led thatI already tested as
output) when I read an input high. My output is always off (seems that I'm
unable to read input from portc. What am I doing wrong here ? TIA
My CPU is AT90S8515
int main()
{
unsigned int i;
unsigned char c ;
// enable all bits of PORTA as outputs
DDRA = 0xff;
// enable all bits of PORTC as inputs
DDRC = 0x00;
while (1) {
if (PORTC)
PORTA = 0xFF ;
else
PORTA = 0 ;
}
return 0;
}
_______________________________________________
avr-gcc-list mailing list
address@hidden http://www.avr1.org/mailman/listinfo/avr-gcc-list