找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1275|回复: 0
打印 上一主题 下一主题
收起左侧

dht11温湿度检测器制作 5001显示 带单片机源码

[复制链接]
跳转到指定楼层
楼主
做了一个基于dht11和5001显示模块的温湿度检测器


单片机源程序如下:
  1. #include <reg52.h>
  2. #include"dht11.h"
  3. sbit    res = P2^0;  //复位,0复位
  4. sbit    sce = P2^1;  //片选
  5. sbit    dc  = P2^2;  //1写数据,0写指令
  6. sbit    sdin = P2^3;  //数据
  7. sbit    sclk = P2^4;  //时钟

  8. unsigned char code shuzi[]={
  9. /*--  文字:  0  --*/
  10. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  11. 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
  12. /*--  文字:  1  --*/
  13. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  14. 0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,

  15. /*--  文字:  2  --*/
  16. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  17. 0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,

  18. /*--  文字:  3  --*/
  19. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  20. 0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,

  21. /*--  文字:  4  --*/
  22. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  23. 0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,

  24. /*--  文字:  5  --*/
  25. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  26. 0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,

  27. /*--  文字:  6  --*/
  28. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  29. 0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,

  30. /*--  文字:  7  --*/
  31. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  32. 0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,

  33. /*--  文字:  8  --*/
  34. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  35. 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,

  36. /*--  文字:  9  --*/
  37. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  38. 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,

  39. /*--  文字:  a  --10*/
  40. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  41. 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,

  42. /*--  文字:  b  --11*/
  43. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  44. 0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,

  45. /*--  文字:  c  --12*/
  46. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  47. 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,

  48. /*--  文字:  d  --13*/
  49. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  50. 0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,

  51. /*--  文字:  e  --*/
  52. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  53. 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,

  54. /*--  文字:  f  --*/
  55. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  56. 0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,

  57. /*--  文字:  g  --16*/
  58. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  59. 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,

  60. /*--  文字:  h  --*/
  61. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  62. 0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,

  63. /*--  文字:  i  --*/
  64. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  65. 0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,

  66. /*--  文字:  j  --19*/
  67. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  68. 0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,

  69. /*--  文字:  k  --*/
  70. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  71. 0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,

  72. /*--  文字:  l  --*/
  73. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  74. 0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,

  75. /*--  文字:  m  --22*/
  76. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  77. 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,

  78. /*--  文字:  n  --23*/
  79. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  80. 0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,

  81. /*--  文字:  o  --24*/
  82. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  83. 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,

  84. /*--  文字:  p  --*/
  85. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  86. 0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,

  87. /*--  文字:  q  --*/
  88. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  89. 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,

  90. /*--  文字:  r  --*/
  91. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  92. 0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,
  93.                                                                                                                                                           
  94. /*--  文字:  s  --*/
  95. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  96. 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,

  97. /*--  文字:  t  --*/
  98. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  99. 0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,

  100. /*--  文字:  u  --30*/
  101. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  102. 0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,

  103. /*--  文字:  v  --*/
  104. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  105. 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,

  106. /*--  文字:  w  --*/
  107. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  108. 0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,

  109. /*--  文字:  x  --*/
  110. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  111. 0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,

  112. /*--  文字:  y  --*/
  113. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  114. 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,

  115. /*--  文字:  z  --35*/
  116. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  117. 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,

  118. /*--  文字:  -  --*/
  119. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  120. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,

  121. /*--  文字:  =  --*/
  122. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  123. 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,

  124. /*--  文字:  \  --*/
  125. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  126. 0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,

  127. /*--  文字:     --39*/
  128. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  129. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

  130. /*--  文字:  [  --*/
  131. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  132. 0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,

  133. /*--  文字:  ]  --*/
  134. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  135. 0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,

  136. /*--  文字:  ;  --*/
  137. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  138. 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,

  139. /*--  文字:  '  --*/
  140. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  141. 0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

  142. /*--  文字:  ,  --*/
  143. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  144. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,

  145. /*--  文字:  .  --45*/
  146. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  147. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,

  148. /*--  文字:  /  --*/
  149. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  150. 0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,
  151.        
  152. };

  153. unsigned char code maohao[]={
  154. /*--  文字:  :  --*/
  155. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  156. 0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00


  157. };
  158. unsigned char code jiaohao[]={

  159. /*--  文字:  + - --48*/
  160. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  161. 0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,

  162. /*--  文字:  +  --49*/
  163. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  164. 0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

  165. /*--  文字:  -  --50*/
  166. /*--  宋体12;  此字体下对应的点阵为:宽x高=8x16   --*/
  167. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00
  168. };

  169. unsigned char code hanzi[]=
  170. {
  171. /*--  文字:  温  --*/
  172. /*--  Trebuchet MS12;  此字体下对应的点阵为:宽x高=16x16   --*/
  173. 0x10,0x60,0x02,0x8C,0x00,0x00,0xFE,0x92,0x92,0x92,0x92,0x92,0xFE,0x00,0x00,0x00,
  174. 0x04,0x04,0x7E,0x01,0x40,0x7E,0x42,0x42,0x7E,0x42,0x7E,0x42,0x42,0x7E,0x40,0x00,
  175. /*--  文字:  度  --*/
  176. /*--  Trebuchet MS12;  此字体下对应的点阵为:宽x高=16x16   --*/
  177. 0x00,0x00,0xFC,0x24,0x24,0x24,0xFC,0x25,0x26,0x24,0xFC,0x24,0x24,0x24,0x04,0x00,
  178. 0x40,0x30,0x8F,0x80,0x84,0x4C,0x55,0x25,0x25,0x25,0x55,0x4C,0x80,0x80,0x80,0x00,

  179. /*--  文字: : --*/
  180. /*--  Trebuchet MS12;  此字体下对应的点阵为:宽x高=16x16   --*/
  181. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  182. 0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

  183. /*--  文字:    --*/
  184. /*--  Trebuchet MS12;  此字体下对应的点阵为:宽x高=16x16   --*/
  185. 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x18,0x10,0x00,
  186. 0x80,0x40,0x30,0x0F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,0x00,0x00,0x00,

  187. /*--  文字:  机  --*/
  188. /*--  Trebuchet MS12;  此字体下对应的点阵为:宽x高=16x16   --*/
  189. 0x08,0x08,0xC8,0xFF,0x48,0x88,0x08,0x00,0xFE,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,
  190. 0x04,0x03,0x00,0xFF,0x00,0x41,0x30,0x0C,0x03,0x00,0x00,0x00,0x3F,0x40,0x78,0x00,

  191. /*--  文字:  湿  --*/
  192. /*--  Trebuchet MS12;  此字体下对应的点阵为:宽x高=16x16   --*/
  193. 0x10,0x60,0x02,0x8C,0x00,0xFE,0x92,0x92,0x92,0x92,0x92,0x92,0xFE,0x00,0x00,0x00,
  194. 0x04,0x04,0x7E,0x01,0x44,0x48,0x50,0x7F,0x40,0x40,0x7F,0x50,0x48,0x44,0x40,0x00,

  195. /*--  文字:  度  --*/
  196. /*--  Trebuchet MS12;  此字体下对应的点阵为:宽x高=16x16   --*/
  197. 0x00,0x00,0xFC,0x24,0x24,0x24,0xFC,0x25,0x26,0x24,0xFC,0x24,0x24,0x24,0x04,0x00,
  198. 0x40,0x30,0x8F,0x80,0x84,0x4C,0x55,0x25,0x25,0x25,0x55,0x4C,0x80,0x80,0x80,0x00,

  199. /*--  文字:  网  --*/
  200. /*--  Trebuchet MS12;  此字体下对应的点阵为:宽x高=16x16   --*/
  201. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  202. 0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  203. };

  204. void delay_1ms(unsigned int i)//1ms延时函数
  205. {
  206.        
  207.         for (i=0;i<500;i++);
  208. }

  209. /*--------------------------------------------
  210. LCD_write_byte: 使用SPI接口写数据到LCD
  211. 输入参数:dt:写入的数据;
  212. command :写数据/命令选择;
  213. 编写日期:20080918
  214. ----------------------------------------------*/
  215. void LCD_write_byte(unsigned char dt, unsigned char command)
  216. {
  217.         unsigned char i;
  218.         sce=0;       
  219.         dc=command;       
  220.         for(i=0;i<8;i++)
  221.         {
  222.                 if(dt&0x80)
  223.                         sdin=1;
  224.                 else
  225.                         sdin=0;
  226.                 dt=dt<<1;               
  227.                 sclk=0;                
  228.                 sclk=1;
  229.         }       
  230.         dc=1;       
  231.         sce=1;       
  232.         sdin=1;
  233. }
  234. /*---------------------------------------
  235. LCD_init: 3310LCD初始化
  236. 编写日期:20080918
  237. -----------------------------------------  */
  238. void LCD_init(void)
  239. {
  240.         res=0;         
  241.           delay_1ms(1);
  242.           res=1;  
  243.         LCD_write_byte(0x21,0);//初始化Lcd,功能设定使用扩充指令
  244.         LCD_write_byte(0xa8,0);//设定液晶偏置电压
  245.         LCD_write_byte(0x20,0);//使用基本指令
  246.         LCD_write_byte(0x0C,0);//设定显示模式,正常显示
  247. }
  248. /*-------------------------------------------
  249. LCD_set_XY: 设置LCD坐标函数
  250. 输入参数:X:0-83  Y:0-5
  251. 编写日期:20080918
  252. ---------------------------------------------*/
  253. void LCD_set_XY(unsigned char X, unsigned char Y)
  254. {
  255.         LCD_write_byte(0x40 | Y, 0);// column
  256.         LCD_write_byte(0x80 | X, 0);// row
  257. }
  258. /*------------------------------------------
  259. LCD_clear: LCD清屏函数
  260. 编写日期:20080918
  261. --------------------------------------------*/
  262. void LCD_clear(void)
  263. {
  264.         unsigned char t;
  265.         unsigned char k;
  266.         LCD_set_XY(0,0);
  267.         for(t=0;t<6;t++)
  268.         {
  269.                 for(k=0;k<84;k++)
  270.                 {
  271.                         LCD_write_byte(0x00,1);
  272.                                
  273.                 }
  274.         }
  275. }
  276. /*---------------------------------------------
  277. LCD_write_shu: 显示8(宽)*16(高)点阵列数字字母符号等半角类
  278. 输入参数:c:显示的字符;
  279. 编写日期:20080918
  280. -----------------------------------------------*/
  281. void LCD_write_shu(unsigned char row, unsigned char page,unsigned char c) //row:列 page:页 dd:字符
  282. {
  283.         unsigned char i;         
  284.        
  285.         LCD_set_XY(row*8, page);// 列,页
  286.         for(i=0; i<8;i++)
  287.         {
  288.                 LCD_write_byte(shuzi[c*16+i],1);
  289.         }
  290.        
  291.     LCD_set_XY(row*8, page+1);// 列,页
  292.         for(i=8; i<16;i++)
  293.         {
  294.                 LCD_write_byte(shuzi[c*16+i],1);
  295.         }                
  296. }
  297. /*---------------------------------------------
  298. LCD_write_hanzi: 显示16(宽)*16(高)点阵列汉字等半角类
  299. 输入参数:c:显示的字符;
  300. 编写日期:20080918
  301. -----------------------------------------------*/
  302. void LCD_write_hanzi(unsigned char row, unsigned char page,unsigned char c) //row:列 page:页 dd:字符
  303. {
  304.         unsigned char i;         
  305.        
  306.         LCD_set_XY(row*8, page);// 列,页
  307.         for(i=0; i<16;i++)
  308.         {
  309.                 LCD_write_byte(hanzi[c*32+i],1);
  310.         }
  311.        
  312.     LCD_set_XY(row*8, page+1);// 列,页
  313.         for(i=16; i<32;i++)
  314.         {
  315.                 LCD_write_byte(hanzi[c*32+i],1);
  316.         }       
  317. }
  318. void delay(unsigned int i)
  319. {
  320.         while(i--);
  321. }
  322. main()
  323. {       
  324.           unsigned char k,i;
  325.         i=1;
  326.         res=0;
  327.         for(k=0;k<250;k++);
  328.         res=1;                 
  329.           LCD_init();  //初始化LCD模块
  330.         LCD_clear(); //清屏幕
  331.         dht11_init();       

  332.           while(1)
  333.           {
  334.        
  335.                 LCD_write_hanzi(0,0,0);  //温       
  336.                 LCD_write_hanzi(2,0,1);  //度
  337.                 LCD_write_hanzi(4,0,2);  //:
  338.                
  339.                 LCD_write_hanzi(0,2,5);  //湿
  340.                 LCD_write_hanzi(2,2,6);  //度
  341.                 LCD_write_hanzi(4,2,7);  //:
  342.                        
  343.                 LCD_write_shu(5,0,i);
  344.           }
  345. }
复制代码

所有资料51hei提供下载:
温湿度检测.rar (29.7 KB, 下载次数: 12)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表