rabhishek91
New Member
Hi everyone. 
I am working on a code where i need to display messages on LCD depending on the input to MUC(Atmega32A).
Below is the program where i need to display messages based on PortA input.
First. i'll read the pin0 of PORTA (continously). Depending on the value of that pin i'll control LCD messages. I know i have made lot of mistakes in programming. This is my first program so i am unaware of what to use.
Is this programming method correct ? or do i need to use some other method ?
Please help me.
I am working on a code where i need to display messages on LCD depending on the input to MUC(Atmega32A).
Below is the program where i need to display messages based on PortA input.
First. i'll read the pin0 of PORTA (continously). Depending on the value of that pin i'll control LCD messages. I know i have made lot of mistakes in programming. This is my first program so i am unaware of what to use.
Is this programming method correct ? or do i need to use some other method ?
Please help me.
C:
int main()
{
DDRA = 0x00; //configure portA as input
while(1) // To run the program continuously
{
if(PORTA&=1<<PINA0)//Check high on pin0 of portA
{
DDRB=0xff; // Configure PORTB as output for data bus
DDRD=0x07; //Configure PORTD as output for control lines
init_LCD(); // initialization of LCD
_delay_ms(50); // delay of 50 mili seconds
LCD_write_string("ABC");
}
else
{
DDRB=0xff;
DDRD=0x07;
init_LCD();
_delay_ms(50);
LCD_write_string("Thank you");
}
}
return 0;
}
Last edited by a moderator: