求51单片机代码详细注释/解释 50
sbitSpeak=P2^7;sbitRED=P3^3;sbitGREEN=P3^4;sbitRelay=P3^2;sbitKEY1=P1^3;sbitKEY2=P1^4...
sbit Speak = P2^7;
sbit RED = P3^3;
sbit GREEN = P3^4;
sbit Relay = P3^2;
sbit KEY1 = P1^3;
sbit KEY2 = P1^4;
sbit KEY3 = P1^5;
sbit KEY4 = P1^6;
sbit KEY5 = P1^7;
unsigned char idata RevBuffer[30];
unsigned char Card_Num;
void iccardcode();
//系统初始化
void InitializeSystem()
{
PcdReset();
PcdAntennaOff();
PcdAntennaOn();
M500PcdConfigISOType( 'A' );
}
unsigned char idata UID[4],Temp[4];
unsigned char Table[3];
unsigned char Num;
unsigned char Count,Countf,Count1,Count2,Count3,Count4,Count5,C_flag;
void Auto_Reader(void)
{
if(PcdRequest(0x52,Temp)==0)
{
if(PcdAnticoll(UID)==0)
{
Speak=0;delay_10ms(20);Speak=1;
Table[0]=UID[0]/100+0x30;
Table[1]=UID[0]/10%10+0x30;
Table[2]=UID[0]%10+0x30;
LCD1602_Disp_ZF(0x80+0x40,"Num: ",16);
LCD1602_Disp_ZF(0x84+0x40,Table,3);
Count = UID[0];
if((Count==Count1)||(Count==Count2)||(Count==Count3)||(Count==Count4)||(Count==Count5))
{
LCD1602_Disp_ZF(0x8a+0x40,"OK ",5);
GREEN = 0;Relay=0;delay_10ms(200);Relay=1;GREEN = 1;
C_flag=1;
}
else
{
LCD1602_Disp_ZF(0x8a+0x40,"Error",5);
RED = 0;delay_10ms(200);RED = 1;
C_flag=2;
}
delay_10ms(200);
LCD1602_Disp_ZF(0x80+0x40,"debit card",16);
}
}
}
uchar DS1302_Table[7]={0}; //读取时间值
void Display_LCD2(uchar Dis_Hour,uchar Dis_Min,uchar Dis_Sec)
{
uchar Dis_Table[8]="11:22:33";
Dis_Table[0] = Dis_Hour/10+0x30;
Dis_Table[1] = Dis_Hour%10+0x30;
Dis_Table[3] = Dis_Min/10+0x30;
Dis_Table[4] = Dis_Min%10+0x30;
Dis_Table[6] = Dis_Sec/10+0x30;
Dis_Table[7] = Dis_Sec%10+0x30;
LCD1602_Disp_ZF(0x85,Dis_Table,8);
} 展开
sbit RED = P3^3;
sbit GREEN = P3^4;
sbit Relay = P3^2;
sbit KEY1 = P1^3;
sbit KEY2 = P1^4;
sbit KEY3 = P1^5;
sbit KEY4 = P1^6;
sbit KEY5 = P1^7;
unsigned char idata RevBuffer[30];
unsigned char Card_Num;
void iccardcode();
//系统初始化
void InitializeSystem()
{
PcdReset();
PcdAntennaOff();
PcdAntennaOn();
M500PcdConfigISOType( 'A' );
}
unsigned char idata UID[4],Temp[4];
unsigned char Table[3];
unsigned char Num;
unsigned char Count,Countf,Count1,Count2,Count3,Count4,Count5,C_flag;
void Auto_Reader(void)
{
if(PcdRequest(0x52,Temp)==0)
{
if(PcdAnticoll(UID)==0)
{
Speak=0;delay_10ms(20);Speak=1;
Table[0]=UID[0]/100+0x30;
Table[1]=UID[0]/10%10+0x30;
Table[2]=UID[0]%10+0x30;
LCD1602_Disp_ZF(0x80+0x40,"Num: ",16);
LCD1602_Disp_ZF(0x84+0x40,Table,3);
Count = UID[0];
if((Count==Count1)||(Count==Count2)||(Count==Count3)||(Count==Count4)||(Count==Count5))
{
LCD1602_Disp_ZF(0x8a+0x40,"OK ",5);
GREEN = 0;Relay=0;delay_10ms(200);Relay=1;GREEN = 1;
C_flag=1;
}
else
{
LCD1602_Disp_ZF(0x8a+0x40,"Error",5);
RED = 0;delay_10ms(200);RED = 1;
C_flag=2;
}
delay_10ms(200);
LCD1602_Disp_ZF(0x80+0x40,"debit card",16);
}
}
}
uchar DS1302_Table[7]={0}; //读取时间值
void Display_LCD2(uchar Dis_Hour,uchar Dis_Min,uchar Dis_Sec)
{
uchar Dis_Table[8]="11:22:33";
Dis_Table[0] = Dis_Hour/10+0x30;
Dis_Table[1] = Dis_Hour%10+0x30;
Dis_Table[3] = Dis_Min/10+0x30;
Dis_Table[4] = Dis_Min%10+0x30;
Dis_Table[6] = Dis_Sec/10+0x30;
Dis_Table[7] = Dis_Sec%10+0x30;
LCD1602_Disp_ZF(0x85,Dis_Table,8);
} 展开
1个回答
展开全部
首先,这代码不全……
其次,你需要解释哪些东西?这程序主体包含读卡头初始化、液晶初始化、显示时间/字符串等多种功能,基本上就是做个带液晶显示的读卡器。
其次,你需要解释哪些东西?这程序主体包含读卡头初始化、液晶初始化、显示时间/字符串等多种功能,基本上就是做个带液晶显示的读卡器。
追问
IC门禁 功能就是显示时分秒,液晶显示lcd1602
M500PcdConfigISOType( 'A' )
unsigned char idata UID[4],Temp[4]
unsigned char Count,Countf,Count1,Count2,Count3,Count4,Count5,C_flag
LCD1602_Disp_ZF(0x8a+0x40,"OK ",5)
Table[0]=UID[0]/100+0x30;
LCD1602_Disp_ZF(0x80+0x40,"Num: ",16)
uchar Dis_Table[8]="11:22:33"
不知道那几句定义了什么,还有就是上面几句含义,麻烦解释下
如果要完整代码我可以发给你
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询