找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2184|回复: 0
收起左侧

单片机多功能记录器(记录温湿度,物品停留时间并存入eeprom与pc通信)

[复制链接]
ID:293382 发表于 2018-5-21 12:26 | 显示全部楼层 |阅读模式
0.png 0.jpg

单片机源程序如下:
  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)

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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