AVR128的程序——12864液晶与ds1302与ds18b20的综合运用
0x82
#define ds1302_hr_add 0x84
#define ds1302_date_add 0x86
#define ds1302_month_add 0x88
#define ds1302_day_add 0x8a
#define ds1302_year_add 0x8c
#define ds1302_control_add 0x8e
#define ds1302_charger_add 0x90
#define ds1302_clkburst_add 0xbe
uchar timer[7]={12,2,29,23,59,50,3};
void shi_BCD(void)
{
for(i=0;i<7;i++)
{
timer[i]=timer[i];
timer[i]=timer[i]+k*16;
}
}
void ds1302_init(void)
{
set_ds1302_rst_ddr();
set_ds1302_sclk_ddr();
clr_ds1302_rst();
}
void ds1302_write(uchar add,uchar data)
{
set_ds1302_io_ddr();
add = add & 0xFE;
}
uchar ds1302_read(uchar add)
{
}
void ds1302_write_time(void)
{
}
void ds1302_read_time(void)
{
}
void time_Process(void)
{
shi = timer[3]+10*temp1;
temp2 = timer[4]/16;
fen = timer[4]+10*temp2;
temp3 = timer[5]/16;
num = timer[5]+10*temp3;
temp4 = timer[2]/16;
ri = timer[2]+10*temp4;
temp5 = timer[1]/16;
yue = timer[1]+10*temp5;
temp6 = timer[6]/16;
zhou = timer[6]+10*temp6;
}
#endif
#ifndef __DS18B20_H__
#define __DS18B20_H__
#define uchar unsigned char
#define uint
#define DQ_IN DDRE &= ~(1 < PE6)
#define DQ_OUT DDRE |= (1 < PE6)
#define DQ_CLR PORTE &= ~(1 < PE6)
#define DQ_SET PORTE |= (1 < PE6)
#define DQ_R PINE & (1 < PE6)
unsigned char ds1820_reset(void)
{
unsigned char i;
DQ_OUT;
DQ_CLR;
Delayus(500);
DQ_SET;
DQ_IN;
Delayus(100);
i = DQ_R;
Delayus(500);
return i;
}
unsigned char ds1820_read_byte(void)
{
unsigned char i;
unsigned char valu
AVR12812864液晶ds1302ds18b2 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)