diff --git a/lcd.c b/lcd.c index 5ec3fcf..2367157 100644 --- a/lcd.c +++ b/lcd.c @@ -102,11 +102,10 @@ void lcd_init() { //*************************************************************************************** void lcd_write_char (char c) { - if(char_counter == LCD_WIDTH) lcd_nibble_out(LCD_ADDR_LINE2,0); - if(char_counter == (LCD_WIDTH*2)){ - lcd_nibble_out(LCD_ADDR_LINE1,0); - char_counter = 0; - } + if(char_counter == LCD_WIDTH) lcd_set_position(1,0); + if(char_counter == 2*LCD_WIDTH) lcd_set_position(2,0); + if(char_counter == 3*LCD_WIDTH) lcd_set_position(3,0); + if(char_counter == 4*LCD_WIDTH) lcd_set_position(0,0); char_counter++; lcd_nibble_out(c, 1); } @@ -114,12 +113,11 @@ void lcd_write_char (char c) { //*************************************************************************************** void lcd_print_str(char *str) { while (*str != 0){ - if(char_counter == LCD_WIDTH) lcd_nibble_out(LCD_ADDR_LINE2,0); - if(char_counter == (LCD_WIDTH*2)){ - lcd_nibble_out(LCD_ADDR_LINE1,0); - char_counter = 0; - } - char_counter++; + if(char_counter == LCD_WIDTH) lcd_set_position(1,0); + if(char_counter == 2*LCD_WIDTH) lcd_set_position(2,0); + if(char_counter == 3*LCD_WIDTH) lcd_set_position(3,0); + if(char_counter == 4*LCD_WIDTH) lcd_set_position(0,0); + char_counter++; lcd_nibble_out(*str++, 1); } }