Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
LCD控制器         HD44780U
2
3
LCD控制器方塊圖 RS → R/W →           DR                            DDRAM E   →   資料暫存器     → DB0     Busy Flag       Address cou...
5
6
DDRAM顯示器記憶體    位址00寫入41      A               B           位址46寫入42      41               42                   DDRAM        ...
MCU 與 LCD 接腳關係    LCD_RS = 0;    LCD_RW = 0;RD4             RS    LCD_E = 1; RD5            R/W       PIC18F4520    LCD_Da...
LCD 接腳定義#define   LCD_RS LATDbits.LATD4#define   LCD_RW LATDbits.LATD5#define   LCD_E    LATAbits.LATA2#deine    LCD_DATA ...
LCD 操作方式RS   R/W 0    0    寫入 IR 暫存器寫操作 0    1    讀取 Busy Flay 和 address counter 1    0    寫入 DR 暫存器 1    1    讀取 DR 暫存器  ...
LCD 控制指令 RS → R/W →           DR                             DDRAM E   →   資料暫存器     → DB0     Busy Flag        Address co...
讀取Busy flag  RS →  R/W →            DR                                  DDRAM  E   →   資料暫存器      →  DB0         Busy Flag...
資料寫入DDRAM RS → R/W →           DR                             DDRAM E   →   資料暫存器     → DB0     Busy Flag        Address c...
讀取DDRAM資料 RS → R/W →           DR                             DDRAM E   →   資料暫存器     → DB0     Busy Flag        Address c...
LCD 指令類群 RS R/W 0   0    寫入 IR 暫存器寫操作 0   1    讀取 Busy Flay 和 address counter 1   0    寫入 DR 暫存器 1   1    讀取 DR 暫存器       ...
LCD 指令類群 RS R/W 0   0    void LcdCmd( unsigned char data ); 0   1    unsigned char ReadBF( void ); 1   0    void LPutC( un...
LCD 8 位元操作模式               17
LCD 8 位元操作模式               18
19
LCD 4 位元操作模式               20
LCD 4 位元操作模式               21
LCD 讀取操作           22
寫入 DR 暫存器    LCD_RS = 1;    LCD_RW = 0;           LCD_E= 1;     LCD_E = 0;            LCD_DATA = data;                    ...
LCD 控制指令    LCD_RS = 0;    LCD_RW = 0;           LCD_E= 1;     LCD_E = 0;            LCD_DATA = data;                     ...
讀取 DR 暫存器    LCD_RS = 1;    LCD_RW = 1;           LCD_E= 1;      LCD_E = 0;            data = LCD_DIN;                    ...
讀取Busy flag      LCD_RS = 0;      LCD_RW = 1;             LCD_E= 1;      LCD_E = 0;              data = LCD_DIN;          ...
27
28
29
30
時序圖      31
500230500230      32
33
34
寫入DR資料暫存器            35
寫入IR指令暫存器            36
讀取 DR 暫存器            37
讀取Busy flag              38
Upcoming SlideShare
Loading in …5
×

艾鍗學院-單晶片韌體開發- LCM模組實驗

19,362 views

Published on

艾鍗學院-單晶片韌體開發課程講義-LCM模組實驗
16x2文字型LCM

Published in: Education, Technology, Business
  • Be the first to comment

艾鍗學院-單晶片韌體開發- LCM模組實驗

  1. 1. LCD控制器 HD44780U
  2. 2. 2
  3. 3. 3
  4. 4. LCD控制器方塊圖 RS → R/W → DR DDRAM E → 資料暫存器 → DB0 Busy Flag Address counter → to → DB3 → → DB4 → IR to → CGRAM CGROM DB7 → 指令暫存器 4
  5. 5. 5
  6. 6. 6
  7. 7. DDRAM顯示器記憶體 位址00寫入41 A B 位址46寫入42 41 42 DDRAM 7
  8. 8. MCU 與 LCD 接腳關係 LCD_RS = 0; LCD_RW = 0;RD4 RS LCD_E = 1; RD5 R/W PIC18F4520 LCD_Data = RA2 Data; E LCD_E = 0; LCD RD0 DB4 RD1 DB5 RD2 DB6 RD3 DB7 8
  9. 9. LCD 接腳定義#define LCD_RS LATDbits.LATD4#define LCD_RW LATDbits.LATD5#define LCD_E LATAbits.LATA2#deine LCD_DATA LATD#define TRI_RS TRISDbits.TRISD4#define TRI_RW TRISDbits.TRISD5#define TRI_E TRISAbits.TRISA2#define TRI_DATA TRISD#define LCD_DIN PORTD 9
  10. 10. LCD 操作方式RS R/W 0 0 寫入 IR 暫存器寫操作 0 1 讀取 Busy Flay 和 address counter 1 0 寫入 DR 暫存器 1 1 讀取 DR 暫存器 10
  11. 11. LCD 控制指令 RS → R/W → DR DDRAM E → 資料暫存器 → DB0 Busy Flag Address counter → to → DB3 → → DB4 → IR to → CGRAM CGROM DB7 → 指令暫存器 11
  12. 12. 讀取Busy flag RS → R/W → DR DDRAM E → 資料暫存器 → DB0 Busy Flag Address counter → to → DB3 → → DB4 → IR to → CGRAM CGROM DB7 → 指令暫存器 12
  13. 13. 資料寫入DDRAM RS → R/W → DR DDRAM E → 資料暫存器 → DB0 Busy Flag Address counter → to → DB3 → → DB4 → IR to → CGRAM CGROM DB7 → 指令暫存器 13
  14. 14. 讀取DDRAM資料 RS → R/W → DR DDRAM E → 資料暫存器 → DB0 Busy Flag Address counter → to → DB3 → → DB4 → IR to → CGRAM CGROM DB7 → 指令暫存器 14
  15. 15. LCD 指令類群 RS R/W 0 0 寫入 IR 暫存器寫操作 0 1 讀取 Busy Flay 和 address counter 1 0 寫入 DR 暫存器 1 1 讀取 DR 暫存器 15
  16. 16. LCD 指令類群 RS R/W 0 0 void LcdCmd( unsigned char data ); 0 1 unsigned char ReadBF( void ); 1 0 void LPutC( unsigned char data ); 1 1 unsigned char LGetC( void ); 16
  17. 17. LCD 8 位元操作模式 17
  18. 18. LCD 8 位元操作模式 18
  19. 19. 19
  20. 20. LCD 4 位元操作模式 20
  21. 21. LCD 4 位元操作模式 21
  22. 22. LCD 讀取操作 22
  23. 23. 寫入 DR 暫存器 LCD_RS = 1; LCD_RW = 0; LCD_E= 1; LCD_E = 0; LCD_DATA = data; 23
  24. 24. LCD 控制指令 LCD_RS = 0; LCD_RW = 0; LCD_E= 1; LCD_E = 0; LCD_DATA = data; 24
  25. 25. 讀取 DR 暫存器 LCD_RS = 1; LCD_RW = 1; LCD_E= 1; LCD_E = 0; data = LCD_DIN; 25
  26. 26. 讀取Busy flag LCD_RS = 0; LCD_RW = 1; LCD_E= 1; LCD_E = 0; data = LCD_DIN; 26
  27. 27. 27
  28. 28. 28
  29. 29. 29
  30. 30. 30
  31. 31. 時序圖 31
  32. 32. 500230500230 32
  33. 33. 33
  34. 34. 34
  35. 35. 寫入DR資料暫存器 35
  36. 36. 寫入IR指令暫存器 36
  37. 37. 讀取 DR 暫存器 37
  38. 38. 讀取Busy flag 38

×