Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef LCD_H_
- #define LCD_H_
- #define RS_PIN 0
- #define RW_PIN 1
- #define EN_PIN 2
- #define RS_PORT PORTC
- #define RW_PORT PORTC
- #define EN_PORT PORTC
- #define RS_DDR DDRC
- #define RW_DDR DDRC
- #define EN_DDR DDRC
- #define LCD_1_LINE_ADDR 0x80
- #define LCD_2_LINE_ADDR 0xC0
- #define LCD_3_LINE_ADDR 0x94
- #define LCD_4_LINE_ADDR 0xD4
- //if defined LCD4, use 4-bit interface, else use 8-bit interface
- #define LCD4
- void LCDInit(void);
- void LCDBusy(void);
- void LCDData(unsigned char data);
- void LCDCommand(unsigned char cmd);
- inline void LCDSetPosition(unsigned char line, unsigned char col)
- {
- LCDBusy();
- unsigned char addr;
- switch(line)
- {
- case 1: addr=LCD_1_LINE_ADDR; break;
- case 2: addr=LCD_2_LINE_ADDR; break;
- case 3: addr=LCD_3_LINE_ADDR; break;
- case 4: addr=LCD_4_LINE_ADDR; break;
- default: addr=LCD_1_LINE_ADDR;
- }
- addr+=col;
- LCDCommand(addr);
- }
- inline void LCDWriteChar(char ch)
- {
- LCDBusy();
- LCDData(ch);
- }
- void LCDWriteString(char* str, unsigned char strLen);
- void LCDWriteStringZ(char* str);
- #endif LCD_H_
Add Comment
Please, Sign In to add comment