机动车限行提示器程序
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
{
T_RST = 0;
T_CLK = 0;
T_RST = 1;
RTInputByte(ucAddr); /*地址,命令*/
RTInputByte(ucDa); /*写1Byte数据*/
T_CLK = 1;
T_RST = 0;
}
uchar R1302(unsigned char ucAddr)
{
unsigned char ucData;
void Set1302(unsigned char *);/*设置日期、时间和汽车尾号*/
void Get1302(unsigned char curvalue[]); /*读取DS1302当前时间*/
void bcd_ds(unsigned char *dclock);/*数据格式转换*/
typedef struct
{
unsigned char hour;
unsigned char min;
unsigned char sec;
unsigned char date;
unsigned char month;
unsigned char today;
unsigned char year;
unsigned char number;
unsigned char RClock[7];
void RTInputByte(unsigned char d)
{
unsigned char i;
ACC = d; /*d写入的数据*/
for(i=8; i>0; i--)
{
T_IO = ACC0;
T_CLK = 1;
T_CLK = 0;
ACC = ACC >> 1;
void chkbusy_GLCD();/*检查lcd状态*/
void command_GLCD(unsigned char ord);/*往lcd写命令*/
void initial_GLCD();/*初始化lcd*/
void RTInputByte(unsigned char);/*往DS1302写入1Byte数据*/
{
unsigned char i;
unsigned char ucAddr = 0x80;
W1302(0x8e,0x00);/*清除写保护位*/
for(i =7; i>0; i--)
{
W1302(ucAddr,*pClock);
pCloBiblioteka Baiduk++;
ucAddr +=2;
}
W1302(0x8e,0x80); /*控制命令,WP=1,写保护*/
#include <reg51.h>
sbit LCD_CLK = P1^0; /*LCD时钟线引脚*/
sbit LCD_SID = P1^1; /*LCD数据线引脚*/
sbit LCD_CS = P1^2; /*LCD片选线引脚*/
sbit ctrout = P1^3;/*控制输出*/
sbit T_RST = P1^4; /*实时时钟复位线引脚*/
sbit T_IO = P1^5; /*实时时钟数据线引脚*/
sbit T_CLK = P1^6; /*实时时钟时钟线引脚*/
sbit sw_1 = P3^0; /*开关1*/
sbit sw_2 = P3^1; /*开关2*/
sbit sw_3 = P3^2; /*开关3*/
sbit sw_4 = P3^3; /*开关4*/
unsigned char RTOutputByte(void);/*从DS1302读取1Byte数据*/
void W1302(unsigned char, unsigned char);/*写数据到DS1302*/
unsigned char R1302(unsigned char);/*读DS1302数据*/
}
void Get1302(unsigned char ucCurvalue[])
sbit ACC0 = ACC^0;
sbit ACC7 = ACC^7;
sbit key_flag = PSW^5;
/*调用函数声明*/
void delay();/*延时*/
void keydis();/*键盘处理*/
void write_GLCD(unsigned char dat);/*写数据到lcd*/
,"50","51","52","53","54","55","56","57","58","59",
};
static char xdata DHZTAB1[15]="日期20XX:XX:XX";
static char xdata DHZTAB2[15]="时间XX:XX:XX ";
static char xdata DHZTAB3[12]="今日不能开车";
}x;
x value;
/*定义12232液晶屏所显示的日期和时间码*/
char code bcdmap[60][2]={
"00","01","02","03", "04","05","06","07","08","09"
,"10","11","12","13","14","15","16","17","18","19"
}
}
unsigned char RTOutputByte(void)
{
unsigned char i;
for(i=8; i>0; i--)
{
ACC = ACC >>1;
ACC7 = T_IO;
T_CLK = 1;
T_CLK = 0;
}
return(ACC);
}
void W1302(unsigned char ucAddr, unsigned char ucDa)
T_RST = 0;
T_CLK = 0;
T_RST = 1;
RTInputByte(ucAddr); /*地址,命令*/
ucData = RTOutputByte(); /*读1Byte数据*/
T_CLK = 1;
T_RST = 0;
return(ucData);
}
void Set1302(unsigned char *pClock)
,"20","21","22","23","24","25","26","27","28","29"
,"30","31","32","33","34","35","36","37","38","39"
,"40","41","42","43","44","45","46","47","48","49"
T_RST = 0;
T_CLK = 0;
T_RST = 1;
RTInputByte(ucAddr); /*地址,命令*/
RTInputByte(ucDa); /*写1Byte数据*/
T_CLK = 1;
T_RST = 0;
}
uchar R1302(unsigned char ucAddr)
{
unsigned char ucData;
void Set1302(unsigned char *);/*设置日期、时间和汽车尾号*/
void Get1302(unsigned char curvalue[]); /*读取DS1302当前时间*/
void bcd_ds(unsigned char *dclock);/*数据格式转换*/
typedef struct
{
unsigned char hour;
unsigned char min;
unsigned char sec;
unsigned char date;
unsigned char month;
unsigned char today;
unsigned char year;
unsigned char number;
unsigned char RClock[7];
void RTInputByte(unsigned char d)
{
unsigned char i;
ACC = d; /*d写入的数据*/
for(i=8; i>0; i--)
{
T_IO = ACC0;
T_CLK = 1;
T_CLK = 0;
ACC = ACC >> 1;
void chkbusy_GLCD();/*检查lcd状态*/
void command_GLCD(unsigned char ord);/*往lcd写命令*/
void initial_GLCD();/*初始化lcd*/
void RTInputByte(unsigned char);/*往DS1302写入1Byte数据*/
{
unsigned char i;
unsigned char ucAddr = 0x80;
W1302(0x8e,0x00);/*清除写保护位*/
for(i =7; i>0; i--)
{
W1302(ucAddr,*pClock);
pCloBiblioteka Baiduk++;
ucAddr +=2;
}
W1302(0x8e,0x80); /*控制命令,WP=1,写保护*/
#include <reg51.h>
sbit LCD_CLK = P1^0; /*LCD时钟线引脚*/
sbit LCD_SID = P1^1; /*LCD数据线引脚*/
sbit LCD_CS = P1^2; /*LCD片选线引脚*/
sbit ctrout = P1^3;/*控制输出*/
sbit T_RST = P1^4; /*实时时钟复位线引脚*/
sbit T_IO = P1^5; /*实时时钟数据线引脚*/
sbit T_CLK = P1^6; /*实时时钟时钟线引脚*/
sbit sw_1 = P3^0; /*开关1*/
sbit sw_2 = P3^1; /*开关2*/
sbit sw_3 = P3^2; /*开关3*/
sbit sw_4 = P3^3; /*开关4*/
unsigned char RTOutputByte(void);/*从DS1302读取1Byte数据*/
void W1302(unsigned char, unsigned char);/*写数据到DS1302*/
unsigned char R1302(unsigned char);/*读DS1302数据*/
}
void Get1302(unsigned char ucCurvalue[])
sbit ACC0 = ACC^0;
sbit ACC7 = ACC^7;
sbit key_flag = PSW^5;
/*调用函数声明*/
void delay();/*延时*/
void keydis();/*键盘处理*/
void write_GLCD(unsigned char dat);/*写数据到lcd*/
,"50","51","52","53","54","55","56","57","58","59",
};
static char xdata DHZTAB1[15]="日期20XX:XX:XX";
static char xdata DHZTAB2[15]="时间XX:XX:XX ";
static char xdata DHZTAB3[12]="今日不能开车";
}x;
x value;
/*定义12232液晶屏所显示的日期和时间码*/
char code bcdmap[60][2]={
"00","01","02","03", "04","05","06","07","08","09"
,"10","11","12","13","14","15","16","17","18","19"
}
}
unsigned char RTOutputByte(void)
{
unsigned char i;
for(i=8; i>0; i--)
{
ACC = ACC >>1;
ACC7 = T_IO;
T_CLK = 1;
T_CLK = 0;
}
return(ACC);
}
void W1302(unsigned char ucAddr, unsigned char ucDa)
T_RST = 0;
T_CLK = 0;
T_RST = 1;
RTInputByte(ucAddr); /*地址,命令*/
ucData = RTOutputByte(); /*读1Byte数据*/
T_CLK = 1;
T_RST = 0;
return(ucData);
}
void Set1302(unsigned char *pClock)
,"20","21","22","23","24","25","26","27","28","29"
,"30","31","32","33","34","35","36","37","38","39"
,"40","41","42","43","44","45","46","47","48","49"