Hi everyone!
I just wanted to show 2 statement (with a delay time between them) in a 2X16 character LCD via ATMEGA32A .. I use C language and Codvision compiler..
but when I run the circuit all of sections in line one in LCD get lighted (as shown in pic)
In order to test if the chip get programmed properly or not I used an LED in bit 0 at port A
and I see LED works.. but LCD does not
where is the problem
??
and my codes:
I just wanted to show 2 statement (with a delay time between them) in a 2X16 character LCD via ATMEGA32A .. I use C language and Codvision compiler..
but when I run the circuit all of sections in line one in LCD get lighted (as shown in pic)
In order to test if the chip get programmed properly or not I used an LED in bit 0 at port A
where is the problem

and my codes:
Rich (BB code):
/*****************************************************
This program was produced by the
CodeWizardAVR V2.05.0 Advanced
Automatic Program Generator
© Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 2011/10/14
Author : www.Eca.ir *** www.Webkade.ir
Company :
Comments:
Chip type : ATmega32A
Program type : Application
AVR Core Clock frequency: 4.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 512
*****************************************************/
#include <mega32a.h>
#include <delay.h>
// Alphanumeric LCD Module functions
#include <alcd.h>
// Declare your global variables here
void main(void)
{
int i;
for(i=0;i<=9;i++)
{
PORTA.0=1;
delay_ms(350);
PORTA.0=0;
delay_ms(350);
}
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Alphanumeric LCD initialization
// Connections specified in the
// Project|Configure|C Compiler|Libraries|Alphanumeric LCD menu:
// RS - PORTC Bit 0
// RD - PORTC Bit 1
// EN - PORTC Bit 2
// D4 - PORTC Bit 4
// D5 - PORTC Bit 5
// D6 - PORTC Bit 6
// D7 - PORTC Bit 7
// Characters/line: 16
lcd_init(16);
while (1)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("state1");
delay_ms(1000);
lcd_putsf(" state2");
delay_ms(1000);
}
}