單片機源程序如下:
- #include <reg52.h>
- #include <stdio.h>
- #include <string.h>
- #include "define.h"
- #include "display.h"
- #include "iic.h"
- #include "ds18b20.h"
- #include "ds1302.h"
- sbit key4 = P3^3;
- void main()
- {
- Commont_Init();
- Timer0Init();
- AT24c02_Write(0x00,79);
- Ds1302_Init(0x11,0x08,0x34);
- while(1)
- {
- if(key4 == 0)
- {
- Delay9ms();
- if(key4 == 0)
- {
- Type++;
- if(Type == 3)
- {
- Type = 0;
- }
- while(!key4);
- }
- }
- if(Type == 0)
- {
- Display_Seg_Time(ValueHou,ValueMin,ValueSec);
- }
- else if(Type == 1)
- {
- Display_Seg_6(Value1Pcf8591,Value2Pcf8591);
- }
- }
- }
- void Time0_Serve() interrupt 1
- {
- ValueHou = Ds1302_Single_Byte_Read(0x85);
- ValueMin = Ds1302_Single_Byte_Read(0x83);
- ValueSec = Ds1302_Single_Byte_Read(0x81);
-
- ValueNum++;
- ValueDs++;
- if(ValueNum == 10)
- {
- ValueNum = 0;
- Flag_i = !Flag_i;
- }
- if(ValueDs == 40)
- {
- ValueDs = 0;
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
2014.多功能記錄儀.zip
(168.7 KB, 下載次數: 37)
2018-5-21 12:26 上傳
點擊文件名下載附件
|