Advertisement
Guest User

Untitled

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