avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Heli reding inputs from PORTC


From: Helix
Subject: [avr-gcc-list] Heli reding inputs from PORTC
Date: Mon, 2 Feb 2004 23:32:07 +0100

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;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]