further adjustments for 4*20 lcd

This commit is contained in:
2021-05-21 03:05:42 +02:00
parent 5866c1f6f0
commit d9087580b2

20
lcd.c
View File

@@ -102,11 +102,10 @@ void lcd_init() {
//*************************************************************************************** //***************************************************************************************
void lcd_write_char (char c) { void lcd_write_char (char c) {
if(char_counter == LCD_WIDTH) lcd_nibble_out(LCD_ADDR_LINE2,0); if(char_counter == LCD_WIDTH) lcd_set_position(1,0);
if(char_counter == (LCD_WIDTH*2)){ if(char_counter == 2*LCD_WIDTH) lcd_set_position(2,0);
lcd_nibble_out(LCD_ADDR_LINE1,0); if(char_counter == 3*LCD_WIDTH) lcd_set_position(3,0);
char_counter = 0; if(char_counter == 4*LCD_WIDTH) lcd_set_position(0,0);
}
char_counter++; char_counter++;
lcd_nibble_out(c, 1); lcd_nibble_out(c, 1);
} }
@@ -114,12 +113,11 @@ void lcd_write_char (char c) {
//*************************************************************************************** //***************************************************************************************
void lcd_print_str(char *str) { void lcd_print_str(char *str) {
while (*str != 0){ while (*str != 0){
if(char_counter == LCD_WIDTH) lcd_nibble_out(LCD_ADDR_LINE2,0); if(char_counter == LCD_WIDTH) lcd_set_position(1,0);
if(char_counter == (LCD_WIDTH*2)){ if(char_counter == 2*LCD_WIDTH) lcd_set_position(2,0);
lcd_nibble_out(LCD_ADDR_LINE1,0); if(char_counter == 3*LCD_WIDTH) lcd_set_position(3,0);
char_counter = 0; if(char_counter == 4*LCD_WIDTH) lcd_set_position(0,0);
} char_counter++;
char_counter++;
lcd_nibble_out(*str++, 1); lcd_nibble_out(*str++, 1);
} }
} }