add set position function for lcd
This commit is contained in:
18
lcd.c
18
lcd.c
@@ -44,6 +44,22 @@ void lcd_nibble_out(unsigned char c, unsigned char cd) {
|
||||
lcd_out(out | rs );
|
||||
}
|
||||
|
||||
void lcd_set_position(uint8_t row, uint8_t col){
|
||||
if(col >= LCD_WIDTH)
|
||||
return;
|
||||
|
||||
if(row==0)
|
||||
lcd_nibble_out(0x80|col, 0);
|
||||
if(row==1)
|
||||
lcd_nibble_out(0xC0|col, 0);
|
||||
if(row==2)
|
||||
lcd_nibble_out(0x80|(col+LCD_WIDTH), 0);
|
||||
if(row==3)
|
||||
lcd_nibble_out(0xC0|(col+LCD_WIDTH), 0);
|
||||
|
||||
char_counter = (row * LCD_WIDTH) + col;
|
||||
}
|
||||
|
||||
//***************************************************************************************
|
||||
// clear LCD
|
||||
void lcd_clear() {
|
||||
@@ -184,4 +200,4 @@ void lcd_write_P (const char *Buffer,...)
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user