#ifndef __MAIN_H__
#define __MAIN_H__
#include
#include
#include
#define uchar unsigned char
#define uint unsigned int
#define DQ P3_7
#endif
ds18b20.h
#include "main.h"
uint sec;
uint min=41;
uint hour=18;
uint day=20;
uint month=4;
uint yearl=11;
uint yearh=20;
uint tcnt;
uint cursor=0;
uchar a=0xff;
uchar code Seg[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void delay(uint t)
{
}
void Tdelay(unsigned int i)
{
}
void Kdelay(unsigned int z)
{
}
Init_DS18B20(void)
{
}
//读一个字节
ReadOneChar(void)
{
unsigned char i=0;
unsigned char dat = 0;
for (i=8;i>0;i--)
}
//写一个字节
WriteOneChar(unsigned char dat)
{
}
//读取温度
ReadTemperature(void)
{
unsigned char a=0;
unsigned char b=0;
unsigned int t=0;
float tt=0;
Init_DS18B20();
WriteOneChar(0xCC);
WriteOneChar(0x44);
Init_DS18B20();
WriteOneChar(0xCC);
WriteOneChar(0xBE);
a=ReadOneChar();
b=ReadOneChar();
t=b;
t<<=8;
t=t|a;
tt=t*0.0625;
t= tt*10+0.5;
return(t);
}
void display(uchar L1,uchar L2,uchar L3,uchar L4,uchar L5,uchar L6,uchar L7,uchar L8,uchar L9,uchar L10,uchar L11,uchar L12,uchar L13,uchar L14,uchar L15,uchar L16)
{
}
main.c
#include "main.h"
#include "ds18B20.h"
void delay(uint t);
void Tdelay(unsigned int i);
void Kdelay(unsigned int z);
Init_DS18B20(void);
ReadOneChar(void);
WriteOneChar(unsigned char dat);
ReadTemperature(void);
void display(uchar L1,uchar L2,uchar L3,uchar L4,uchar L5,uchar L6,uchar L7,uchar L8,uchar L9,uchar L10,uchar L11,uchar L12,uchar L13,uchar L14,uchar L15,uchar L16);
main()
{
}
void t0(void)interrupt 1 using 0
{
}
上一篇:步进电机正反转程序
下一篇:1602字符液晶详细资料和实例 (续)
推荐阅读最新更新时间:2024-03-16 14:41