[讨论] 【Nucleo心得】+mbed显示图片

ddllxxrr   2014-10-1 11:53 楼主

上一贴点亮了显示屏,觉得不错,那就显示一下买屏时带的图片吧。

这个屏的位置得注意,我用uchar不行的。刚开始调时我还以为卖我屏的那个卖家程序有毛病了呢。

查半天才看到是自己的有病,改成uint就OK啦!

上程序:
  1. include "mbed.h"

  2. SPI device(SPI_MOSI, SPI_MISO, SPI_SCK);

  3. typedef unsigned char uchar;
  4. typedef unsigned int uint;
  5. DigitalOut rs(D10);
  6. DigitalOut cs(D9);
  7. DigitalOut reset(D8);


  8. unsigned char image[3200]=
  9. {
  10. /* 0X00,0X10,0X28,0X00,0X28,0X00,0X01,0X1B,*/
  11. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  12. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,
  13. 0XBA,0XD6,0XB6,0XB5,0XF3,0X9C,0XB2,0X94,0XB3,0X9C,0XB2,0X94,0X34,0XA5,0XF7,0XBD,
  14. 0XFB,0XDE,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  15. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  16. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  17. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0XFB,0XDE,0XF3,0X9C,0XCB,0X5A,
  18. 0XC7,0X39,0X04,0X21,0X82,0X10,0X42,0X10,0X42,0X10,0X41,0X08,0X83,0X18,0X45,0X29,
  19. 0XC7,0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FF,0XFF,
  32. 0XFF,0XFF,0XFB,0XDE,0XCB,0X5A,0X82,0X10,0X45,0X29,0XC7,0X39,0X08,0X42,0X08,0X42,
  33. 0X09,0X4A,0X49,0X4A,0X49,0X4A,0X49,0X4A,0X49,0X4A,0X49,0X4A,0X08,0X42,0XC7,0X39,
  34. 0XC7,0X39,0XC7,0X39,0X86,0X31,0X45,0X29,0X83,0X18,0X00,0X00,0XC8,0X41,0X38,0XC6,
  35. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  36. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  37. 0X7D,0XEF,0X8E,0X73,0X82,0X10,0X45,0X29,0XC7,0X39,0X08,0X42,0X09,0X4A,0X8A,0X52,
  38. 0X30,0X84,0XCF,0X7B,0X8A,0X52,0X49,0X4A,0X4A,0X52,0X49,0X4A,0XCB,0X5A,0XCF,0X7B,
  39. 0X0C,0X63,0X08,0X42,0XC7,0X39,0X86,0X31,0X45,0X29,0XC3,0X18,0X00,0X00,0X49,0X4A,
  40. 0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  41. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  42. 0XF3,0X9C,0XC3,0X18,0X04,0X21,0XC7,0X39,0X08,0X42,0X49,0X4A,0X49,0X4A,0X72,0X94,
  43. 0X7D,0XEF,0X7D,0XEF,0XB2,0X94,0X4A,0X52,0X49,0X4A,0X8A,0X52,0X75,0XAD,0XBE,0XF7,
  44. 0XBA,0XD6,0X4D,0X6B,0XC7,0X39,0XC7,0X39,0X86,0X31,0X45,0X29,0XC3,0X18,0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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  71. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0XB2,0X8C,0X41,0X08,
  72. 0XC7,0X39,0X08,0X42,0X49,0X4A,0X49,0X4A,0X8A,0X52,0X8A,0X52,0X4A,0X4A,0XD0,0X7B,
  73. 0X7A,0XC6,0X7B,0XBE,0X90,0X6B,0XC9,0X39,0X88,0X31,0XC9,0X39,0XB3,0X84,0XBB,0XC6,
  74. 0XF8,0XB5,0XCC,0X5A,0X86,0X31,0XC7,0X39,0XC7,0X39,0X86,0X31,0X45,0X29,0X45,0X29,
  75. 0XC4,0X20,0X41,0X08,0X30,0X84,0X3C,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  76. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3C,0XE7,0X8A,0X4A,0XC3,0X10,
  77. 0XC7,0X39,0X08,0X42,0X49,0X4A,0X49,0X4A,0X4A,0X4A,0X4A,0X42,0X09,0X3A,0X08,0X4A,
  78. 0X09,0X6B,0X49,0X7B,0XC6,0X7A,0X05,0X83,0X46,0X83,0XC5,0X7A,0XC6,0X72,0X09,0X7B,
  79. 0X48,0X5A,0X87,0X31,0X88,0X21,0X88,0X29,0X86,0X31,0X86,0X31,0X45,0X29,0X45,0X29,
  80. 0X04,0X21,0X41,0X08,0X4A,0X4A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  81. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF7,0XC5,0X82,0X50,0X05,0X41,
  82. 0XC7,0X29,0X08,0X42,0X49,0X4A,0X4A,0X42,0X49,0X4A,0X09,0X7B,0X88,0X9B,0XC6,0XB3,
  83. 0X21,0XD4,0XA0,0XDC,0XE1,0XE4,0X61,0XED,0X61,0XED,0X21,0XED,0XA0,0XE4,0X20,0XDC,
  84. 0X80,0XCB,0X43,0XAB,0XC4,0X82,0X06,0X5A,0X47,0X21,0X46,0X29,0X45,0X29,0X04,0X29,
  85. 0X04,0X19,0X82,0X10,0X82,0X18,0XF3,0X9C,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  86. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0X4D,0X93,0X00,0XA0,0X82,0XB8,
  87. 0XC7,0X31,0X09,0X32,0X49,0X4A,0X86,0X7A,0X43,0XC3,0X6B,0XED,0XF4,0XF6,0XEB,0XFD,
  88. 0X20,0XFD,0X20,0XFD,0X60,0XFD,0XA0,0XFD,0XA0,0XFD,0X60,0XFD,0X60,0XFD,0X20,0XFD,
  89. 0XE0,0XFC,0XA0,0XFC,0X60,0XF4,0XC1,0XDB,0X83,0X9A,0XC5,0X49,0X45,0X29,0X04,0X19,
  90. 0XC4,0X20,0X82,0X38,0X00,0X50,0XCB,0X6A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  91. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XEE,0X04,0XA1,0X00,0XC0,0X00,0XF0,
  92. 0XC3,0XA0,0XC8,0X41,0X49,0X42,0X05,0X9B,0X20,0XFC,0XA4,0XFC,0X69,0XFD,0XE8,0XFD,
  93. 0X63,0XFD,0X20,0XFD,0X60,0XFD,0X60,0XFD,0X60,0XFD,0X20,0XFD,0X20,0XFD,0XE0,0XFC,
  94. 0XE0,0XFC,0XA0,0XFC,0X60,0XFC,0X20,0XFC,0X41,0XD3,0XC5,0X49,0X45,0X19,0XC4,0X38,
  95. 0X82,0X68,0X41,0X88,0X00,0X70,0X49,0X5A,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  96. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XF6,0X82,0XC0,0X00,0XD0,0X86,0XC1,
  97. 0X46,0XF1,0X41,0XC8,0X45,0X79,0X89,0X52,0X88,0X62,0X86,0X6A,0XC6,0X7A,0XC4,0XBB,
  98. 0XE1,0XFC,0X60,0XFD,0X60,0XFD,0XA0,0XFD,0XA0,0XFD,0X60,0XFD,0X60,0XFD,0XE0,0XFC,
  99. 0X60,0XE4,0X03,0X93,0X84,0X72,0X44,0X6A,0XC5,0X41,0X45,0X29,0XC3,0X58,0X41,0XA8,
  100. 0X40,0X98,0X00,0XB0,0X00,0X60,0X0C,0X6B,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  101. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0XCE,0X83,0X82,0X88,0X00,0XF8,0XC4,0XD8,
  102. 0X0C,0XF3,0X8A,0XFA,0X82,0XE8,0X82,0XB0,0X45,0X69,0XC7,0X51,0X08,0X42,0X08,0X3A,
  103. 0X86,0X5A,0X83,0X9B,0XA2,0XBC,0X22,0XCD,0X21,0XCD,0XA1,0XC4,0X22,0XB4,0XC4,0X7A,
  104. 0X06,0X3A,0X86,0X29,0X45,0X29,0X05,0X31,0XC4,0X50,0X41,0X90,0X00,0XC0,0X00,0XA8,
  105. 0X00,0XA0,0X00,0XA8,0X00,0X30,0X4A,0X4A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  106. 0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0X8E,0X73,0XC3,0X18,0X05,0X39,0X82,0XA8,0X00,0XF8,
  107. 0XC3,0XF8,0X4D,0XFB,0X4D,0XFB,0XC7,0XF9,0XC3,0XF0,0X82,0XD8,0XC3,0XB0,0X04,0X81,
  108. 0X45,0X61,0X46,0X51,0X86,0X49,0X86,0X49,0X46,0X41,0X45,0X41,0X45,0X41,0X45,0X41,
  109. 0X05,0X49,0X04,0X61,0X82,0X90,0X41,0XB0,0X00,0XD0,0X00,0XC8,0X00,0XA8,0X00,0XA8,
  110. 0X00,0XB8,0X41,0X58,0X82,0X10,0X82,0X10,0XB2,0X94,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,
  111. 0XFF,0XFF,0XBE,0XF7,0XCF,0X7B,0X82,0X10,0X04,0X21,0X86,0X29,0X86,0X41,0X04,0X99,
  112. 0X40,0XE8,0X41,0XF8,0X86,0XF9,0XCB,0XFA,0X49,0XFA,0X82,0XF8,0X00,0XF8,0X00,0XF0,
  113. 0X00,0XE8,0X41,0XD8,0X41,0XD0,0X41,0XC0,0X41,0XC0,0X41,0XC0,0X41,0XC0,0X41,0XC8,
  114. 0X00,0XD0,0X00,0XE0,0X00,0XE0,0X00,0XD8,0X00,0XD0,0X00,0XB8,0X00,0XA8,0X41,0X88,
  115. 0X82,0X48,0X82,0X10,0X82,0X10,0X00,0X00,0X45,0X29,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,
  116. 0XBE,0XF7,0XF3,0X9C,0X82,0X10,0XC3,0X18,0X45,0X29,0X86,0X31,0XC7,0X31,0X30,0X7C,
  117. 0XF3,0XDC,0X86,0XE1,0X00,0XF0,0X00,0XF8,0X41,0XF8,0X41,0XF8,0X00,0XF8,0X00,0XF8,
  118. 0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,
  119. 0X00,0XE8,0X00,0XE0,0X00,0XE0,0X00,0XD8,0X00,0XC8,0X41,0XA0,0X8A,0X9A,0X0C,0X63,
  120. 0X04,0X11,0X82,0X10,0X82,0X10,0X41,0X08,0X00,0X00,0X4D,0X6B,0X7D,0XEF,0XFF,0XFF,
  121. 0XFB,0XDE,0X08,0X42,0X42,0X10,0X45,0X29,0X86,0X31,0X86,0X31,0X49,0X4A,0X38,0XBE,
  122. 0XFF,0XFF,0X38,0XD6,0X86,0XA9,0X00,0XC8,0X00,0XE0,0X00,0XF0,0X00,0XF8,0X00,0XF8,
  123. 0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF0,0X00,0XF0,
  124. 0X00,0XE8,0X00,0XE0,0X00,0XD0,0XC3,0X98,0X8A,0X8A,0XB2,0XA4,0XBA,0XC6,0XF7,0XB5,
  125. 0X08,0X42,0X41,0X08,0X82,0X10,0X41,0X08,0X00,0X00,0X45,0X29,0XF7,0XBD,0XFF,0XFF,
  126. 0X71,0X8C,0X41,0X08,0X04,0X21,0X45,0X29,0X86,0X31,0X86,0X31,0X0C,0X63,0X3C,0XE7,
  127. 0XFF,0XFF,0X79,0XD6,0X46,0XB9,0X00,0XE0,0X42,0XC8,0X82,0XA8,0X82,0XB0,0X41,0XD8,
  128. 0X82,0XE8,0X82,0XF0,0X41,0XE8,0X41,0XE8,0X41,0XE8,0X41,0XF0,0X41,0XE8,0X41,0XD8,
  129. 0X04,0XC1,0X08,0X92,0X4D,0X8B,0X34,0XA5,0XFB,0XC6,0XFB,0XD6,0XBA,0XCE,0X3C,0XE7,
  130. 0X30,0X84,0XC3,0X18,0X41,0X08,0X41,0X08,0X00,0X00,0X41,0X08,0XCF,0X7B,0X7D,0XEF,
  131. 0X49,0X4A,0X00,0X00,0X04,0X21,0X45,0X29,0X46,0X31,0X86,0X31,0X30,0X84,0XFF,0XFF,
  132. 0XFF,0XF7,0XF7,0XDD,0X09,0XDA,0X83,0XF8,0X01,0XF0,0X42,0XC0,0X82,0X98,0X49,0X9A,
  133. 0XF3,0XB4,0XF3,0XCC,0X71,0XBC,0X8E,0XBB,0X8E,0XBB,0X30,0XBC,0X71,0XBC,0XF3,0XBC,
  134. 0XB6,0XBD,0XFB,0XCE,0XBE,0XE7,0X7D,0XE7,0X3B,0XDF,0XBA,0XD6,0X79,0XCE,0XFB,0XDE,
  135. 0X75,0XAD,0X86,0X31,0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00,0X49,0X4A,0XFB,0XDE,
  136. 0X04,0X21,0X41,0X08,0X04,0X21,0X45,0X29,0X45,0X29,0X87,0X39,0XB2,0X94,0XFF,0XFF,
  137. 0XBE,0XF7,0X34,0XDD,0X0C,0XEB,0X09,0XFA,0X00,0XF0,0X01,0XD8,0X00,0XD8,0X8B,0XD2,
  138. 0X7D,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  139. 0XFF,0XFF,0XBE,0XFF,0X7D,0XEF,0XFB,0XDE,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0XBA,0XD6,
  140. 0X78,0XC6,0XC7,0X39,0X00,0X00,0X41,0X08,0X00,0X00,0X00,0X00,0XC7,0X39,0X79,0XCE,
  141. 0X00,0X00,0X82,0X10,0XC3,0X18,0X04,0X21,0X05,0X29,0X86,0X31,0XB3,0X9C,0XFF,0XFF,
  142. 0XFF,0XF7,0X75,0XDD,0XC7,0XE9,0XC7,0XF9,0X01,0XF8,0X01,0XF0,0X00,0XE8,0X49,0XE2,
  143. 0XFB,0XEE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  144. 0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,0XFB,0XDE,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0XBA,0XD6,
  145. 0XB9,0XCE,0X08,0X42,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XC7,0X39,0X38,0XC6,
  146. 0X00,0X00,0X82,0X10,0X82,0X10,0X04,0X21,0X04,0X21,0X45,0X29,0X30,0X84,0XFF,0XFF,
  147. 0XFF,0XFF,0X38,0XDE,0XC4,0XD0,0X00,0XF0,0X01,0XF8,0X00,0XF8,0X00,0XF0,0X08,0XD2,
  148. 0XFB,0XE6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  149. 0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0X79,0XCE,0XBA,0XD6,
  150. 0X79,0XCE,0XC7,0X39,0X41,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X86,0X31,0X38,0XC6,
  151. 0X00,0X00,0X00,0X00,0XC3,0X18,0XCB,0X5A,0X86,0X31,0XC3,0X18,0XCB,0X5A,0X7D,0XEF,
  152. 0XFF,0XFF,0X7D,0XEF,0XCF,0XBB,0XC3,0XB0,0X41,0XD0,0X41,0XD0,0X82,0XB8,0X4D,0XB3,
  153. 0X7D,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  154. 0XBE,0XF7,0XBE,0XF7,0X3D,0XEF,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0X79,0XCE,0XFA,0XD6,
  155. 0XF7,0XBD,0X04,0X21,0X86,0X31,0X04,0X21,0X00,0X00,0X00,0X00,0X86,0X31,0X38,0XC6,
  156. 0X86,0X31,0XC3,0X18,0XCB,0X5A,0X75,0XAD,0XCF,0X7B,0X41,0X08,0X86,0X31,0XF7,0XBD,
  157. 0XFF,0XFF,0XFF,0XFF,0XBE,0XEF,0X74,0XB5,0X30,0X9C,0X30,0X9C,0X72,0XA4,0XBB,0XD6,
  158. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  159. 0XBE,0XF7,0X7D,0XEF,0X3C,0XE7,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0X79,0XCE,0X3C,0XE7,
  160. 0X71,0X8C,0X81,0X08,0X0C,0X63,0XCF,0X7B,0X82,0X10,0X00,0X00,0X8A,0X52,0X38,0XC6,
  161. 0X75,0XAD,0X71,0X8C,0XB6,0XB5,0X3C,0XE7,0XFB,0XDE,0XC7,0X39,0X00,0X00,0XCF,0X73,
  162. 0XFF,0XFF,0XFF,0XFF,0XFF,0XF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XFC,0X60,0XF5,0X60,0XF5,
  200. 0X20,0XE5,0X80,0X9B,0X86,0X62,0X30,0X84,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  201. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X38,0XC6,0X2D,0X9C,0X05,0X93,
  202. 0X43,0XA3,0X82,0XB3,0XC2,0XBB,0XC2,0XBB,0X22,0XB4,0X82,0XA3,0X42,0X93,0XC3,0X7A,
  203. 0X85,0X62,0X0B,0X63,0X71,0X84,0XB6,0XB5,0X79,0XCE,0X79,0XC6,0XB5,0XAD,0X70,0X94,
  204. 0X4A,0X8B,0X06,0X83,0X04,0X93,0X04,0X9B,0X43,0X9B,0X43,0X9B,0X43,0X93,0X04,0X83,
  205. 0X08,0X73,0X8D,0X73,0XB3,0X94,0X79,0XCE,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  206. 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3C,0XDF,0X38,0XBE,
  207. 0X75,0XB5,0X33,0XA5,0X33,0XA5,0XF3,0X9C,0XF3,0X9C,0XF3,0X9C,0XF3,0X94,0XF3,0X9C,
  208. 0X35,0XA5,0XF8,0XBD,0XFB,0XDE,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7E,0XEF,
  209. 0XBB,0XD6,0XF8,0XBD,0XB6,0XAD,0X75,0XAD,0X34,0XA5,0X33,0X9D,0X34,0X9D,0X35,0XA5,
  210. 0XB7,0XAD,0X79,0XC6,0X3C,0XE7,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
  211. };


  212. uchar bitdata;
  213. void  delay(uint t);


  214. void delay(uint time)
  215. {
  216. uint i,j;
  217.   for(i=0;i<time;i++)
  218.    for(j=0;j<2500;j++);
  219. }


  220. void LCD_CtrlWrite_IC(uchar c)
  221. {
  222. cs=0;

  223. rs=0;
  224. bitdata=c;
  225. device.write(bitdata);
  226. cs=1;


  227. }
  228. void  LCD_DataWrite_IC(uchar d)  
  229. {
  230. cs=0;
  231. rs=1;
  232. bitdata=d;
  233. device.write(bitdata);
  234. cs=1;
  235. }

  236. void LCD_DataWrite(uchar LCD_DataH,uchar LCD_DataL)
  237. {
  238. LCD_DataWrite_IC(LCD_DataH);
  239. LCD_DataWrite_IC(LCD_DataL);
  240. }
  241. void wr_dat(unsigned int dat)
  242. {
  243. LCD_DataWrite_IC(dat>>8);

  244. LCD_DataWrite_IC(dat);
  245. }





  246. void  write_command(uchar c)
  247. {
  248. cs=0;
  249. rs=0;
  250. bitdata=c;
  251. device.write(bitdata);
  252. cs=1;      
  253. }

  254. void  write_data(uchar d)
  255. {
  256. cs=0;
  257. rs=1;
  258. bitdata=d;
  259. device.write(bitdata);
  260. cs=1;
  261. }

  262. void wr_com16(unsigned char i,unsigned char j)   
  263. {         
  264.   cs=0;
  265.   rs=1;
  266.   bitdata=i;
  267. device.write(bitdata);
  268. cs=1;  
  269.   cs=0;
  270. rs=1;
  271. bitdata=j;
  272. device.write(bitdata);
  273. cs=1;

  274. }
  275. //////////////////////////////////////////////////////////////////////////////////////////////

  276. void lcd_initial()
  277. {

  278.    reset=0;
  279.    delay(100);
  280.    reset=1;
  281.    delay(100);


  282.    write_command(0xCB);  
  283.         write_data(0x39);
  284.         write_data(0x2C);
  285.         write_data(0x00);
  286.         write_data(0x34);
  287.         write_data(0x02);

  288.         write_command(0xCF);  
  289.         write_data(0x00);
  290.         write_data(0XC1);
  291.         write_data(0X30);

  292.         write_command(0xE8);  
  293.         write_data(0x85);
  294.         write_data(0x00);
  295.         write_data(0x78);

  296.         write_command(0xEA);  
  297.         write_data(0x00);
  298.         write_data(0x00);

  299.         write_command(0xED);  
  300.         write_data(0x64);
  301.         write_data(0x03);
  302.         write_data(0X12);
  303.         write_data(0X81);

  304.         write_command(0xF7);  
  305.         write_data(0x20);
  306.   
  307.         write_command(0xC0);    //Power control
  308.         write_data(0x23);   //VRH[5:0]

  309.         write_command(0xC1);    //Power control
  310.         write_data(0x10);   //SAP[2:0];BT[3:0]

  311.         write_command(0xC5);    //VCM control
  312.         write_data(0x3e); //对比度调节
  313.         write_data(0x28);

  314.         write_command(0xC7);    //VCM control2
  315.         write_data(0x86);  //--

  316.         write_command(0x36);    // Memory Access Control
  317.         write_data(0x48); //C8     //48 68竖屏//28 E8 横屏

  318.         write_command(0x3A);   
  319.         write_data(0x55);

  320.         write_command(0xB1);   
  321.         write_data(0x00);  
  322.         write_data(0x18);

  323.         write_command(0xB6);    // Display Function Control
  324.         write_data(0x08);
  325.         write_data(0x82);
  326.         write_data(0x27);  

  327.         write_command(0xF2);    // 3Gamma Function Disable
  328.         write_data(0x00);

  329.         write_command(0x26);    //Gamma curve selected
  330.         write_data(0x01);

  331.         write_command(0xE0);    //Set Gamma
  332.         write_data(0x0F);
  333.         write_data(0x31);
  334.         write_data(0x2B);
  335.         write_data(0x0C);
  336.         write_data(0x0E);
  337.         write_data(0x08);
  338.         write_data(0x4E);
  339.         write_data(0xF1);
  340.         write_data(0x37);
  341.         write_data(0x07);
  342.         write_data(0x10);
  343.         write_data(0x03);
  344.         write_data(0x0E);
  345.         write_data(0x09);
  346.         write_data(0x00);

  347.         write_command(0XE1);    //Set Gamma
  348.         write_data(0x00);
  349.         write_data(0x0E);
  350.         write_data(0x14);
  351.         write_data(0x03);
  352.         write_data(0x11);
  353.         write_data(0x07);
  354.         write_data(0x31);
  355.         write_data(0xC1);
  356.         write_data(0x48);
  357.         write_data(0x08);
  358.         write_data(0x0F);
  359.         write_data(0x0C);
  360.         write_data(0x31);
  361.         write_data(0x36);
  362.         write_data(0x0F);

  363.         write_command(0x11);    //Exit Sleep
  364.         delay(120);
  365.                
  366.         write_command(0x29);    //Display on
  367.         write_command(0x2c);

  368. }
  369. void addset(unsigned int x,unsigned int y)
  370. {
  371.     write_command(0x2a);
  372.     wr_com16(x>>8,x);
  373.     write_command(0x2b);
  374.     wr_com16(y>>8,y);
  375.     write_command(0x2c);
  376. }

  377. void dsp_single_colour(uchar DH,uchar DL)
  378. {
  379. unsigned int i,j;
  380. addset(0,0);
  381. for (i=0;i<320;i++)
  382.     for (j=0;j<240;j++)
  383.         wr_com16(DH,DL);   

  384. }

  385. static void LCD_SetPos(unsigned int x0,unsigned int y0,unsigned int x1,unsigned int y1)
  386. {
  387.        write_command(0x2A);
  388.    write_data(x0>>8);
  389.    write_data(x0);
  390.    write_data(x1>>8);
  391.    write_data(x1);
  392.   
  393.    write_command(0x2B);
  394.    write_data(y0>>8);
  395.    write_data(y0);
  396.    write_data(y1>>8);
  397.    write_data(y1);
  398.     write_command(0x2c);
  399. }



  400. void  RamAdressSet()
  401. {
  402.    write_command(0x2A);
  403.    write_data(0x00);
  404.    write_data(0x00);
  405.    write_data(0x00);
  406.    write_data(0xaf);
  407.   
  408.    write_command(0x2B);
  409.    write_data(0x00);
  410.    write_data(0x00);
  411.    write_data(0x00);
  412.    write_data(0xdb);         
  413. }

  414. void test_picture(uchar *map)
  415. {
  416. int i,j;
  417. RamAdressSet();
  418. for(i=0;i<76;i++)
  419. {
  420.   for(j=0;j<96;j++)
  421.   {
  422.     LCD_DataWrite(map[192*i+j*2],map[192*i+j*2+1]);
  423.   }
  424. }   
  425. }


  426. int main() {
  427.     uint k,i,j;
  428.     lcd_initial();
  429.     dsp_single_colour(0x07,0xe0);//绿色
  430.      while(1)
  431.     {
  432.       while(1)
  433.   {
  434. write_command(0x2C);

  435.     dsp_single_colour(0x00,0x7f);

  436.     for(k=0;k<8;k++)
  437.     {
  438.         for(j=0;j<6;j++)
  439.         {   
  440.             LCD_SetPos(40*j,40*k,40*j+39,40*k+39);      //坐标设置
  441.             for(i=0;i<1600;i++)
  442.              {
  443.                  LCD_DataWrite(image[i*2+1],image[i*2]);     //发送颜色数据为提高速度高8位低8位分别传递                        
  444.              }
  445.          }
  446.     }                              

  447.     delay(40000);     
  448.     }
  449. }

  450. }
再传下运行时的照片:
照片 1.JPG

照片 2.JPG





http://shop34182318.taobao.com/ https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr

回复评论

暂无评论,赶紧抢沙发吧
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复