sohotcall

ST7920 LCD Graphic 12864 Serial Mode

Oct 8th, 2018
112
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Pinout:
  2. GND VCC V0 RS R/W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 PSB NC RST VOUT BLA BLK
  3. - GND = 0V
  4. - VCC = 5V
  5. - RS = CS, active high
  6. - R/W = SID
  7. - E = SCLK
  8. - PSB = 0V
  9. - BLA = 3V3
  10. - BLK = 0V
  11.  
  12. Init:
  13. - SendCmdBits(0 0 1 1 0 0 0 0) # 8-bit, basic
  14. - SendCmdBits(0 0 1 1 0 0 0 0) # 8-bit, basic
  15. - SendCmdBits(0 0 0 0 1 1 0 0) # display-on, no-cursor, no-blink
  16. - SendCmdBits(0 0 1 1 0 1 0 0) # 8-bit, extended
  17. - SendCmdBits(0 0 1 1 0 1 0 0) # 8-bit, extended
  18. - SendCmdBits(0 0 1 1 0 1 1 0) # 8-bit, extended, graphic
  19.  
  20. The Address Coordinates (Y,X):
  21. -------------------------------Look carefully!
  22. (0,0) (0, 1)....(0, 7)
  23. (1,0) (1, 1)....(1, 7)
  24. .......................
  25. (31,0)(31, 1)...(31, 7)
  26. (0,8) (0,17)....(0,15)
  27. (1,8) (1,17)....(1,15)
  28. .......................
  29. (31,8)(31,17)...(31,15)
  30.  
  31. Every (Y,X) is 16-bit data:
  32. D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
  33.  
  34. Goto address(Y,X):
  35. - SendCmdBits(1 0 Y5 Y4 Y3 Y2 Y1 Y0)
  36. - SendCmdBits(1 0 0 0 X3 X2 X1 X0)
  37.  
  38. Set 16-bit data:
  39. - SendDataBits(D15 D14 D13 D12 D11 D10 D9 D8)
  40. - SendDataBits(D7 D6 D5 D4 D3 D2 D1 D0)
  41. - The address automatically become (Y, (X+1) MOD 16)
  42.  
  43. SendCmdBits(D7 D6 D5 D4 D3 D2 D1 D0):
  44. - CS = HIGH
  45. - SendBits(1 1 1 1 1 0 0 0)
  46. - SendBits(D7 D6 D5 D4 0 0 0 0)
  47. - SendBits(D3 D2 D1 D0 0 0 0 0)
  48. - CS = LOW
  49.  
  50. SendDataBits(D7 D6 D5 D4 D3 D2 D1 D0):
  51. - CS = HIGH
  52. - SendBits(1 1 1 1 1 0 1 0)
  53. - SendBits(D7 D6 D5 D4 0 0 0 0)
  54. - SendBits(D3 D2 D1 D0 0 0 0 0)
  55. - CS = LOW
  56.  
  57. SendBits(B7 B6 B5 B4 B3 B2 B1 B0):
  58. - SID = B7
  59. - SCLK = HIGH
  60. - SCLK = LOW
  61. ............
  62. - SID = B0
  63. - SCLK = HIGH
  64. - SCLK = LOW
  65.  
  66. If your microcontroller is too fast, add delay.
  67. If not displaying, turn the potentiometer to adjust contrast?
RAW Paste Data