标题: 单片机多功能记录器(记录温湿度,物品停留时间并存入eeprom与pc通信) [打印本页]

作者: 十二期话费    时间: 2018-5-21 12:26
标题: 单片机多功能记录器(记录温湿度,物品停留时间并存入eeprom与pc通信)


单片机源程序如下:
  1. #include <reg52.h>
  2. #include <stdio.h>
  3. #include <string.h>

  4. #include "define.h"
  5. #include "display.h"
  6. #include "iic.h"
  7. #include "ds18b20.h"
  8. #include "ds1302.h"

  9. sbit key4 = P3^3;


  10. void main()
  11. {
  12.         Commont_Init();
  13.         Timer0Init();
  14.         AT24c02_Write(0x00,79);
  15.         Ds1302_Init(0x11,0x08,0x34);
  16.         while(1)
  17.         {
  18.                 if(key4 == 0)
  19.                 {
  20.                         Delay9ms();
  21.                         if(key4 == 0)
  22.                         {
  23.                                 Type++;
  24.                                 if(Type == 3)
  25.                                 {
  26.                                         Type = 0;
  27.                                 }
  28.                                 while(!key4);
  29.                         }
  30.                 }

  31.                 if(Type == 0)
  32.                 {
  33.                         Display_Seg_Time(ValueHou,ValueMin,ValueSec);
  34.                 }          
  35.                 else if(Type == 1)
  36.                 {
  37.                         Display_Seg_6(Value1Pcf8591,Value2Pcf8591);
  38.                 }
  39.         }
  40. }

  41. void Time0_Serve() interrupt 1
  42. {       
  43.         ValueHou = Ds1302_Single_Byte_Read(0x85);
  44.         ValueMin = Ds1302_Single_Byte_Read(0x83);
  45.         ValueSec = Ds1302_Single_Byte_Read(0x81);

  46.        
  47.         ValueNum++;
  48.         ValueDs++;
  49.         if(ValueNum == 10)
  50.         {
  51.                 ValueNum = 0;
  52.                 Flag_i = !Flag_i;
  53.         }
  54.         if(ValueDs == 40)
  55.         {
  56.                 ValueDs = 0;
  57. ……………………

  58. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
2014.多功能记录仪.zip (168.7 KB, 下载次数: 37)












欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1