- This topic has 1 reply, 2 voices, and was last updated 11 years, 9 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › AVR › lcd
i’m using this code for lcd bt it’s showing error ;plz help me out with the errors
#include<avr/io.h>
#include<util/delay.h>
void lcd_init() // fuction for intialize
{
lcd_cmd(0x02); // to initialize LCD in 4-bit mode.
lcd_cmd(0x28); //to initialize LCD in 2 lines, 5X7 dots and 4bit mode.
lcd_cmd(0x0C);
lcd_cmd(0x06);
lcd_cmd(0x83);
}
void lcd_cmnd(unsigned char X)
{
PORTB=X;
PORTD|=_BV(PD0);
PORTD&=~(_BV(PD1));
PORTD|=_BV(PD2);
_delay_ms(10);
PORTD&=~(_BV(PD3));
}
void lcd_data(unsigned char Y)
{
PORTB=Y;
PORTD&=~(_BV(PD0));
PORTD&=~(_BV(PD1));
PORTD|=_BV(PD2);
_delay_ms(10);
PORTD&=~(_BV(PD3));
}
void main()
{
DDRB=0xff;
DDRD=0xff;
lcd_init();
while(1)
{
lcd_data(‘P’);
lcd_data(‘R’);
lcd_data(‘I’);
lcd_data(‘N’);
lcd_data(‘C’);
lcd_data(‘E’);
}}
Hi Nain,
If you are getting errors during the compilation then please post the error dialogue. If you have errors when the code runs please post the details.