In this project i used an ATMega32 controller,interfaced with a laptop and a LCD (16X2 alphaneumeric). I used the Laptop to send serial data to the controller and it used to get displayed on the LCD. This project is a good starting point to learn the basics of ATMega32 as it uses both the USART and LCD interfacing.
Sunday, June 28, 2009
Subscribe to:
Post Comments (Atom)
I have a problem showing things from the RxC to the lcd, though i put them in a buffer and used sprintf to "string"ify them i still don't anything. Is there any way for you to post an example for that?
ReplyDeletecode
ReplyDelete#define F_CPU 11059200UL
void cmd(unsigned char value)
{
PORTA = value;
PORTB = 0b00000100;
_delay_ms(250);
PORTB = 0b00000000;
_delay_ms(250);
}
void data(unsigned char value)
{
PORTA = value;
PORTB = 0b00000101;
_delay_ms(250);
PORTB = 0b00000001;
_delay_ms(250);
}
void send(char* string)
{ while(*string)
{data(*string);
string++;
}
}
void main()
{
DDRA = 0xff; // configure as output
DDRB = 0xff; // configure as output
while(1)
{
_delay_ms(16);
cmd(0x30); // use 1st line
cmd(0x0f);
cmd(0x01); // clear screen
cmd(0x80); // goto 1st char
send("Arjun");
cmd(0x01);
cmd(0x80);
send("Bhasin");
}
}