for(i=1;i<=3;++i)
{
lcd_send_nibble(3);
delay_ms(10);
}
lcd_send_nibble(2);
for(i=0;i<=3;++i)
lcd_send_byte(0,LCD_INIT_STRING[i]);
}
//================================================
//================================================
void lcd_gotoxy( char x, char y)
{char address;
switch(y) {
case 1 : address=0x80;break;
case 2 : address=0xc0;break;
case 3 : address=0x94;break;
case 4 : address=0xd4;break;
}
address=address+(x-1);
lcd_send_byte(0,0x80|address);
}
//=================================================
//=================================================
void lcd_putc( char c) {
switch (c) {
case '\f' : lcd_send_byte(0,1);
delay_ms(2); break;
case '\n' : lcd_gotoxy(1,2); break;
case '\b' : lcd_send_byte(0,0x10); break;
default : lcd_send_byte(1,c); break;
}
}
//====================================================
void LCD_Command(int cm);
void LCD_ShiftLeft(void);
void LCD_ShiftRight(void);
void LCD_MoveRight(char p);
void LCD_MoveLeft(char p);
void LCD_String(char*s,int dly);
void LCD_Command(int cm){
lcd_send_byte(0,cm);
}
void LCD_ShiftLeft(void){
lcd_send_byte(0,0x18);
}
void LCD_ShiftRight(void){
lcd_send_byte(0,0x1C);
}
void LCD_MoveRight(char p){
char i;
for(i=0;i<p;i++){
LCD_ShiftRight();
delay_ms(100);
}
}
void LCD_MoveLeft(char p){
char i;
for(i=0;i<p;i++){
LCD_ShiftLeft();
delay_ms(100);
}
}
void strcpy(char*s1,char*s2) {
while(*s1++ == *s2++);
}
void LCD_String(char*s, int dly) {
while(*s!=0) {
lcd_putc(*s++);
delay_ms(dly);
}
}