diff --git a/lcd.c b/lcd.c index 5b8866a..d5da485 100644 --- a/lcd.c +++ b/lcd.c @@ -1,49 +1,60 @@ -#include //standard AVR header - -#define F_CPU 16000000UL // THE CPU FREQUENCY +#include //standard AVR header +#define F_CPU 16000000UL // THE CPU FREQUENCY #include //delay header +#include //interrupt header -#define LCD_DPRT PORTD //LCD DATA PORT -#define LCD_DDDR DDRD //LCD DATA DDR -#define LCD_DPIN PIND //LCD DATA PIN -#define LCD_CPRT PORTB //LCD COMMANDS PORT -#define LCD_CDDR DDRB //LCD COMMANDS DDR -#define LCD_CPIN PINB //LCD COMMANDS PIN -#define LCD_RS 0 //LCD RS -#define LCD_EN 1 //LCD EN +#define LCD_DPRT PORTD //LCD DATA PORT +#define LCD_DDDR DDRD //LCD DATA DDR +#define LCD_DPIN PIND //LCD DATA PIN +#define LCD_CPRT PORTB //LCD COMMANDS PORT +#define LCD_CDDR DDRB //LCD COMMANDS DDR +#define LCD_CPIN PINB //LCD COMMANDS PIN +#define LCD_RS 0 //LCD RS +#define LCD_EN 1 //LCD EN + +// Define your buffer sizes +#define SERIAL_BUFFER_SIZE 20 +#define NOTES_BUFFER_SIZE 20 -void lcd_putValue(unsigned char val){ +// Global variables +char serialBuffer[SERIAL_BUFFER_SIZE]; +char notesBuffer[NOTES_BUFFER_SIZE]; +int serialIndex = 0; +int notesIndex = 0; +volatile int buttonState = 0; // Holds the state of all buttons +void lcd_putValue(unsigned char val) +{ LCD_DPRT &= 0x0F; - LCD_DPRT |= (val&0xF0); //send cmnd to data port - LCD_CPRT |= (1<