void main () { init(); LCD_print("Welcome !", 0); // top line delay_ms(1000); LCD_print("BIATCH!!!", 1); // bottom line LED = 1; delay_ms(500); int last_key = 0; int key = 0; LCD_reset(); LCD_print("NO KEY", 0); while (1) { //getNum(15); LED = 0; delay_ms(10); //LED = 1; delay_ms(10); key = Keypad_get_key(); if (key != last_key) { if (key == 0) { LCD_print("NO KEY", 0); } else { LCD_print("Pressed ", 0); LCD_char(Keypad_char_for_key(key)); } last_key = key; } }; }
void loop(void) { LCD_reset(); LCD_move_to(0,0); LCD_print("sing"); while (1) ; }
void LCD_init() { pinMode(LCD_E, OUTPUT); pinMode(LCD_RS, OUTPUT); pinMode(LCD_RW, OUTPUT); LCD_reset(); }
void LCD_init() { UBRR1 = 0; //needs to be zero before enabling the transmitter UCSR1A = 0x00; //see comments in top of file UCSR1B = 0x18; //^ UCSR1C = 0xC3; //^ UBRR1 = 1; //run at 2Mbit baud rate (BAUD = fosc/(2*(UBBRn+1)) fosc = 8MHz) UCSR1A |= (1<<TXC1); //clear any existing transmits LCD_reset(); //Send the 'magic' initialisation commands LCD_transmit_command(0x21); //switch to extended commands LCD_transmit_command(0xB0); //set value of Vop (controls contrast) = 0x80 | 0x60 (arbitrary) LCD_transmit_command(0x04); //set temperature coefficient LCD_transmit_command(0x14); //set bias mode to 1:48. LCD_transmit_command(0x20); //switch back to regular commands LCD_transmit_command(0x0C); //enable normal display (dark on light), horizontal addressinfg LCD_transmit_command(0x40); //set Y address to 0 LCD_transmit_command(0x80); //set X address to 0 }