基于飞思卡尔DZ60的AD 1302 KEY 485 CAN FLASH LCD程序
#define DI1 PTGD_PTGD2 //外触发1----->
#define DI2 PTED_PTED5 //外触发2----->
#define DI3 PTED_PTED4 //外触发3----->
#define DI4 PTED_PTED3 //外触发4----->
#define JDQ1 PTCD_PTCD4 //继电器1----->
#define JDQ2 PTAD_PTAD5 //继电器2----->
#define JDQ3 PTBD_PTBD5 //继电器3----->
#define JDQ4 PTAD_PTAD6 //继电器4----->
#define JDQ5 PTBD_PTBD6 //继电器5----->
#define DE485 PTED_PTED2 //485 T R切换----->
if ( value_buf[i]>
if(MonthC1>
minutes=((ReadValue&0x70)>>
day=((ReadValue&0x70)>>
year=((ReadValue&0x70)>>
nian=((temp&0x70)>>
if(nian>
yue=((temp&0x70)>>
if(yue>
0x1412); //时间
DateC2= *p;
p=(byte *)(0x1413); //电量的最低位
MW25L= *p;
p=(byte *)(0x1414); //
MW25H= *p;
p=(byte *)(0x1415); //
MW26L= *p;
p=(byte *)(0x1416); //
MW26H= *p; //
if(MonthC2>12) //如果日期错误,清零
{
MonthC2 = 0;
DateC2= 0;
MW25L = 0;
MW25H = 0;
MW26L = 0;
MW26H = 0;
}
//***************缓存的充电记录,用于比较计算******************
p=(byte *)(0x1421); //
MonthC3= *p;
p=(byte *)(0x1422); //时间
DateC3= *p;
p=(byte *)(0x1423); //电量的最低位
CBETW0L= *p;
p=(byte *)(0x1424); //
CBETW0H= *p;
p=(byte *)(0x1425); //
CBETW1L= *p;
p=(byte *)(0x1426); //
CBETW1H= *p;
if(MonthC3>12) //
{
MonthC3 = 0;
DateC3= 0;
CBETW0L = 0;
CBETW0H = 0;
CBETW1L = 0;
CBETW1H = 0;
}
//**************读取记录的放电的历史记录**************************
//************前1次的前1次的放电记录
p=(byte *)(0x1501); //
MonthF1= *p;
p=(byte *)(0x1502); //时间
DateF1= *p;
p=(byte *)(0x1503); //电量的最低位
MW29L= *p;
p=(byte *)(0x1504); //
MW29H= *p;
p=(byte *)(0x1505); //
MW30L= *p;
p=(byte *)(0x1506); //
MW30H= *p;
if(MonthF1>12)
{
MonthF1 = 0;
DateF1= 0;
MW29L = 0;
MW29H = 0;
MW30L = 0;
MW30H = 0;
}
//*************前1次的放电记录*********************************
p=(byte *)(0x1511); //
MonthF2= *p;
p=(byte *)(0x1512); //时间
DateF2= *p;
p=(byte *)(0x1513); //电量的最低位
MW33L= *p;
p=(byte *)(0x1514); //
MW33H= *p;
p=(byte *)(0x1515); //
MW34L= *p;
p=(byte *)(0x1516); //
MW34H= *p;
if(MonthF2>12) //
{
MonthF2 = 0;
DateF2= 0;
MW33L = 0;
MW33H = 0;
MW34L = 0;
MW34H = 0;
}
//***************缓存的放电记录,用于比较计算******************
p=(byte *)(0x1521); //
MonthF3= *p;
p=(byte *)(0x1522); //时间
DateF3= *p;
p=(byte *)(0x1523); //电量的最低位
FBETW0L= *p;
p=(byte *)(0x1524); //
FBETW0H= *p;
p=(byte *)(0x1525); //
FBETW1L= *p;
p=(byte *)(0x1526); //
FBETW1H= *p;
if(MonthF3>12) //
{
MonthF3 = 0;
DateF3= 0;
FBETW0L = 0;
FBETW0H = 0;
FBETW1L = 0;
FBETW1H = 0;
}
p=(byte *)(0x1601); //
MW8L= *p;
p=(byte *)(0x1602); //时间
MW8H= *p;
p=(byte *)(0x1603); //电量的最低位
MW9L= *p;
p=(byte *)(0x1604); //
MW9H= *p;
if((MW8L==0xff)&&(MW8H==0xff)&&(MW9L==0xff)&&(MW9H==0xff)) //第一次上电
{
MW8L = 0;
MW8H = 0;
MW9L = 0;
MW9H = 0;
P2 = 0;
}
else{
Premain = MW9L+(MW9H<8);
P2= (Premain<16)+ (MW8L+(MW8H<8));
P2 = P2*3600*1000;
}
if(Pchange==0x01) //充电时比较
{
if((time_buf1[2] == MonthC3)&& (time_buf1[3] == DateC3))
{
MW4L = CBETW0L;
MW4H = CBETW0H;
MW5L = CBETW1L;
MW5H = CBETW1H;
Premain = MW5L+(MW5H<8);
P3= (Premain<16)+ (MW4L+(MW4H<8));
P3 = P3*3600;
}
else
{
MW4L = 0;
MW4H = 0;
MW5L = 0;
MW5H = 0;
P3 = 0;
}
}
if(Pchange==0x02) //放电时比较
{
if((time_buf1[2] == MonthF3)&& (time_buf1[3] == DateF3))
{
MW6L = FBETW0L;
MW6H = FBETW0H;
MW7L = FBETW1L;
MW7H = FBETW1H;
Premain = MW7L+(MW7H<8);
P1= (Premain<16)+ (MW6L+(MW6H<8));
P1 = P1*3600;
}
飞思卡尔DZ60AD 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)