Guest User

Untitled

a guest
Jun 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. #ifndef LCD_H_
  2. #define LCD_H_
  3.  
  4. #define RS_PIN      0
  5. #define RW_PIN      1
  6. #define EN_PIN      2
  7.  
  8. #define RS_PORT PORTC
  9. #define RW_PORT PORTC
  10. #define EN_PORT PORTC
  11.  
  12. #define RS_DDR      DDRC
  13. #define RW_DDR      DDRC
  14. #define EN_DDR      DDRC
  15.  
  16. #define LCD_1_LINE_ADDR 0x80
  17. #define LCD_2_LINE_ADDR 0xA8
  18.  
  19. //if defined LCD4, use 4-bit interface, else use 8-bit interface
  20. #define LCD4
  21.  
  22. void LCDInit(void);
  23.  
  24. void LCDBusy(void);
  25. void LCDData(unsigned char data);
  26. void LCDCommand(unsigned char cmd);
  27.  
  28. inline void LCDSetPosition(unsigned char line, unsigned char col)
  29. {
  30.     LCDBusy();
  31.  
  32.     unsigned char addr;
  33.     switch(line)
  34.     {
  35.         case 2: addr=LCD_2_LINE_ADDR; break;
  36.         default:    addr=LCD_1_LINE_ADDR;
  37.     }
  38.     addr+=col;
  39.     LCDCommand(addr);
  40. }
  41.  
  42. inline void LCDWriteChar(char ch)
  43. {
  44.     LCDBusy();
  45.     LCDData(ch);
  46. }
  47.  
  48. void LCDWriteString(char* str, unsigned char strLen);
  49. void LCDWriteStringZ(char* str);
  50.  
  51. #endif /* LCD_H_ */
Advertisement
Add Comment
Please, Sign In to add comment