break;
}
}
LCD_4bit_send(value);
}
void LCD_4bit_send(unsigned char lcd_data)
{
toggle_io(lcd_data, 7, LCD_DB7);
toggle_io(lcd_data, 6, LCD_DB6);
toggle_io(lcd_data, 5, LCD_DB5);
toggle_io(lcd_data, 4, LCD_DB4);
toggle_EN_pin();
toggle_io(lcd_data, 3, LCD_DB7);
toggle_io(lcd_data, 2, LCD_DB6);
toggle_io(lcd_data, 1, LCD_DB5);
toggle_io(lcd_data, 0, LCD_DB4);
toggle_EN_pin();
}
void LCD_putstr(char *lcd_string)
{
do
{
LCD_send(*lcd_string++, DAT);
}while(*lcd_string != '\0');
}
void LCD_putchar(char char_data)
{
LCD_send(char_data, DAT);
}
void LCD_clear_home(void)
{
LCD_send(clear_display, CMD);
LCD_send(goto_home, CMD);
}
void LCD_goto(unsigned char x_pos, unsigned char y_pos)
{
if(y_pos == 0)
{
LCD_send((0x80 | x_pos), CMD);
}
else
{
LCD_send((0x80 | 0x40 | x_pos), CMD);
}
}
void toggle_EN_pin(void)
{
GPIO_WriteHigh(LCD_PORT, LCD_EN);
delay_ms(2);
GPIO_WriteLow(LCD_PORT,LCD_EN);
}
void toggle_io(unsigned char lcd_data, unsigned char bit_pos, unsigned char pin_num)