📄 yibiao.c.bak
字号:
#pragma large
#include "reg52.h"
#include <intrins.h>
#include <absacc.h>
#include <string.h>
#include <ctype.h>
#include <D:\comm_d\comm_pub.H>
#include <D:\comm_d\Jl2key.h>
#include <D:\comm_d\yibiao_p.h>
#include <D:\comm_d\zk.h>
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned char uchar;
typedef unsigned long nlong;
main()
{
/*********主程序开始**********/
bit debug=0;
//char xdata *p;
unsigned char xdata pd=0,i;
unsigned long xdata abc;
//unsigned char xdata ee[100]={1,2,3,4,5,6,7,8,9,0};
//uchar xdata cd[0x1ff];
unsigned char xdata *pk;
unsigned char car_num=0;
bit car_kk=0;
WP=1;
ZK_CS=1;
XBYTE[0xc007]=1;
init_xs();
//dl(200);
init_xs();
//dl(200);
init_xs();
init_xs();
init_xs();
comm_status=0;
init();
ssfl=0;
flash[0]=flash[1]=flash[2]=0x00;
at45d021_wr(flash,3,2000,260);
at45d021_wr(flash,3,2001,260);
jy_xin=0;
/* for(i=0;i<255;i++)
flash[i]=0x0;
for(abc=0;abc<4096;abc++)
{
at45d021_wr(flash,256,abc,0);
//at45d021_wr(flash,256,1861+i,0);
}
*/
xs_hhz(0,0,XTCSH1);
xs_hhz(2,0,XTCSH2);
//while(1);
huakuang(6,8,0);
cuorse(10);
dl(500);
cuorse(40);
dl(600);
cuorse(90);
if (power_init())
{
clear();
xs_hhz(0,0,SJDS);
xs_hhz(2,0,XTCSHCC);
while(1);
}
cuorse(123);
clear();
xs_hhz(0,0,XTZJ1);
xs_hhz(2,0,XTZJ2);
huakuang(6,8,0);
cuorse(10);
psam1_reset();
getVer();
cuorse(40);
card_err_state=read_psam_0015_file();
if (card_err_state!=0)
{
clear();
xs_hhz(0,8,PSAMER);
an_key_back();
goto start;
}
cuorse(90);
dl(500);
de30ms();
card_err_state=rd_terminal();
if (card_err_state!=0)
{
clear();
xs_hhz(0,8,PSAMER);
an_key_back();
goto start;
}
cuorse(123);
lw:
clear();
XTLW_F=1;
xs_hhz(0,0,XTLW1);
xs_hhz(2,0,XTLW2);
huakuang(6,8,0);
cuorse(10);
while(1)
{
main_comm();
if (COMM_CS==3)
{
clear();
xs_hhz(0,0,LWSB1);
xs_hhz(2,0,LWSB2);
while(1)
{
key=getkey();
if (key=='k')
{
NET=1;
goto start1;
}
if (key=='l')
{
COMM_CS=0;
goto lw;
}
}
}
if (XTLW_F==0)
{
NET=0;
break;
}
}
cuorse(40);
dl(600);
cuorse(90);
dl(500);
cuorse(123);
start1:
second=0;
minutes=0x46;
hour=0x12;
day=0x18;
month=0x06;
year=0x02;
settime();
huakuang(6,8,0);
if (NET)
xs_shu(6,2,yi_1+12*8);
start:
xs_time();
clear();
pd=0;/*记录密码验证的次数*/
//youjia[0]=0x03;
//youjia[1]=0x12;
xs_hhz(0,40,JYS);
xs_hhz(2,0,FR);
xs_hhz(4,16,ICK);
while(1)
{
key=getkey();
if ((XBYTE[0xc010]&0x04)==0x04)
{
card_err_state=use_reset(); /*插卡后,用户卡复位*/
if (card_err_state!=0)
{
clear();
xs_hhz(2,48,CKK);
key=0xff;
while(1)
{
key=getkey();
if (key!=0xff)
{
out_card();
goto start;
}
}
}
card_err_state=read_use_list(1);/*读第一条记录*/
if (card_err_state!=0)
{
kybc();
goto start;
}
for(i=0;i<12;i++)
{
use_sel_adf_name[i]=uselistfile[i+4];
}
card_err_state=select_pse();/*选择应用*/
if (card_err_state!=0)
{
kybc();
goto start;
}
now_time[0]=0x20;
now_time[1]=year;
now_time[2]=month;
now_time[3]=day;
card_time[0]=use_pse_inf[24];
card_time[1]=use_pse_inf[25];
card_time[2]=use_pse_inf[26];
card_time[3]=use_pse_inf[27];
//判断卡是否过期
/* if (!strcomp(now_time,card_time,4))
{
clear();
xs_hhz(0,0,KYGQ);
goto start;
}*/
card_err_state=read_use_001b_file();/*读'27'文件*/
if (card_err_state!=0)
{
kybc();
goto start;
}
//read_use_0016_file();
if (use_pse_inf[12]==0x02)
{
menu_2(); /*插入管理卡*/
out_card();
goto start;
}
if (use_pse_inf[12]!=0x04)
{
clear();
xs_hhz(2,32,FYGK);
while(1)
{
key=getkey();
if (key=='t')
{
out_card();
break;
}
xs_time();
}
goto start;
}
ygh=use_001b_file[1];
ygmm[0]=use_001b_file[2];
ygmm[1]=use_001b_file[3];
break;
}
if (key!=0xff)
{
debug=1;
clear();
xs_hhz(2,20,JYJXB);
}
if (debug==1)
dey++;
car_num++;
if (dey>40)
{
clear();
xs_hhz(0,40,JYS);
xs_hhz(2,0,FR);
xs_hhz(4,16,ICK);
debug=0;
dey=0;
}
if ((debug==0)&&(car_num>100))
{
if(car_kk==1)
{
clear();
xs_hhz(0,40,JYS);
xs_hhz(2,0,FR);
xs_hhz(4,16,ICK);
car_kk=0;
car_num=0;
}
else
{
clear();
xs_car();
car_kk=1;
car_num=0;
}
}
xs_time();
}
clear();
xs_hhz(2,30,SBDR);
while(1)
{
key=getkey();
if (key=='s')
goto ok;/*直接按上班键*/
if (key=='t')
{
out_card();
goto start;
}
if (key!=0xff)
if (key=='.')
{
while(1)
{
key=getkey();
if (key=='t')
{
out_card();
goto start;
}
if (key!=0xff)
if (key=='k')
goto ok;
else
{
out_card();
goto start;
}
xs_time();
}
}
else
{
out_card();
goto start;
}
xs_time();
}
ok:
clear();
xs_hhz(0,0,QSRYGMM);
while(1)
{
/*if ((XBYTE[0xc010]&0x04)!=0x00)
goto start;*/
i=password(0);
if (i==2)
{
out_card();
goto start;
}
if (i==1) /*处理员工密码*/
{
clear();
/*处理员工卡密码*/
if (use_001b_file[0]==0)
{
card_err_state=ver_pin1();
if (card_err_state!=0)
{
kybc();
goto start;
}
}
else
{
xs_hhz(0,0,SRYGKMM);
for(i=0;i<=3;i++)
{
key=pass_card();
if (key==2)
{
out_card();
goto start;
}
card_err_state=ver_pin();
if (card_err_state==0)
break;
else
{
clear();
xs_hhz(0,0,MMCWQCS);
}
}
}
if (card_err_state!=0)
{
xs_hhz(0,0,CHDS1);
xs_hhz(2,0,CHDS2);
key=0xff;
while(1)
{
key=getkey();
if (key!=0xff)
{
out_card();/*弹卡*/
goto start;
}
xs_time();
}
}
else
break;
}
if (i==0)
{
clear();
pd++;
if (pd==3)
{
xs_hhz(0,0,MMSC1);
xs_hhz(2,0,MMSC2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -