bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Guys,
I tried to display message on ST7920 LCD,
It's displaying the text already, but I must reset few times before it can display properly,
Do I miss something here ?
Here's the code I used :
Any ideas ?
thanks
I tried to display message on ST7920 LCD,
It's displaying the text already, but I must reset few times before it can display properly,
Do I miss something here ?
Here's the code I used :
Code:
char menu_txt[21] = " ATMEGA128 ";
void lcd_init(){
//st7920
lcd_cmd(0x30);
_delay_ms(100);
lcd_cmd(0x30);
_delay_ms(100);
lcd_cmd(0x0F);
_delay_ms(100);
//lcd_cmd(0x80);
//_delay_ms(10);
lcd_cmd(0x01); //clear screen
_delay_ms(100);
lcd_cmd(0x02);//Return home
_delay_ms(100);
lcd_cmd(0x06);//cursor to the right
_delay_ms(100);
}
void lcd_data(unsigned char data1)
{
lcd_data_pin = data1;// & 0x0F;
en=1;
_delay_us(100);
rs=1;
_delay_us(100);
rw=0;
_delay_ms(10);
en=0;
}
void lcd_cmd(unsigned char cmd){
lcd_data_pin = cmd ;
_delay_us(100);
en=1;
_delay_us(100);
rs=0;
_delay_us(100);
rw=0;
_delay_ms(10);
en=0;
}
void lcd_string(unsigned char *str){
while(*str){
lcd_data(*str++);
}
}
lcd_string(menu_txt);
Any ideas ?
thanks