diff --git a/1602LCD_char_display.c b/1602LCD_char_display.c index 3a13cbd..5078498 100644 --- a/1602LCD_char_display.c +++ b/1602LCD_char_display.c @@ -96,26 +96,57 @@ void turn_on_lcd(void); void set_cgram_lcd_address(uint8_t addr); void set_ddram_lcd_address(uint8_t addr); void write_lcd_address(uint8_t addr); - +void set_entry_mode_increment_lcd(void); +void set_entry_mode_decrement_lcd(void); +void shift_right_lcd(void); +void shift_left_lcd(void); +void bbs(void); +void clear_buf_lcd(); int main() { + PORTD = 0x00; + DDRD = 0xff; + //SETUP HERE. - _delay_ms(500); - - //setup for single line mode. - //cmd_lcd(0x20); - //_delay_ms(1000); - //cmd_lcd(0x28); + led_blink(); + led_blink(); + init_lcd(); + _delay_ms(500); + + return_home_lcd(); while(1) { led_blink(); _delay_ms(1000); - cmd_lcd(0x20); + + set_entry_mode_increment_lcd(); + for(uint8_t i = 0; i < 15; i++) { + //shift_right_lcd(); + write_lcd_address(0x7e); + _delay_ms(100); + } + + set_entry_mode_decrement_lcd(); + for(uint8_t i = 0; i < 15; i++) { + //shift_left_lcd(); + write_lcd_address(0x7f); + _delay_ms(100); + } + //set_cgram_lcd_address(0x00); + //set_entry_mode_increment_lcd(); + //bbs(); + _delay_ms(1000); + clear_lcd(); + PORTD = 0x00; + led_blink(); + led_blink(); + led_blink(); + _delay_ms(1000); + _delay_ms(1000); + _delay_ms(1000); + _delay_ms(1000); _delay_ms(1000); - cmd_lcd(0x28); - _delay_ms(2); - } return 0; @@ -127,21 +158,39 @@ int main() { //FUNCTIONS //############################# -void init_lcd(void) { - //allow us to read pin7 - DDRD = 0x00; - setbit(DDRD, BIT7_DDR); - while(PORTD & (1<