⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zlg500s.h

📁 ZLG522S的功能、硬件接口和ZLG500S相同
💻 H
字号:
#ifdef Zlg500S_GLOBALS
	#define Zlg500S_EXT
#else
	#define Zlg500S_EXT	extern
#endif

Zlg500S_EXT INT8U WaitRespDly;	//等待响应超时计数器
#define ZLG500S_DELAY_500ms		100
#define ZLG500S_DELAY_10ms		2

#define GetDvcInfo_en		1
#define PCDConfig_en		0
#define PCDClose_en			0
#define PCDLoadKey_en		1
#define PCDWriteReg_en		0
#define PCDReadReg_en		0

#define PiccRequest_en		1
#define PiccAnticoll_en		1
#define PiccSelect_en		1
#define PiccHalt_en			1
#define PiccAuthE2_en		1
#define PiccAuthKey_en		0
#define PiccRead_en			1
#define PiccWrite_en		1
#define PiccULWrite_en		0
#define PiccValue_en		1
#define PiccReset_en		0
#define PiccActiveTypeA_en	0
#define PiccAutoDetect_en	1
#define PiccADRcv_en		1
#define PiccReadADDT_en		1

//定义A型卡命令
#define REQSTD		0x26	
#define REQALL		0x52
#define SELCODE1	0x93
#define SELCODE2	0x95
#define SELCODE3	0x97
#define KEYA		0x60
#define KEYB		0x61
#define DECREMENT	0xc0
#define INCREMENT	0xc1
#define RESTORE		0xc2
#define ISO14443A	0x00
#define ISO14443B	0x80

//定义返回错误代码
#define OK			0
#define COMMERR		1
#define SEQERR		2
#define BCCERR		4

//声明设备控制函数
Zlg500S_EXT INT8U GetDvcInfo(INT8U *DvcInfo);
Zlg500S_EXT INT8U PCDConfig();
Zlg500S_EXT INT8U PCDClose();
Zlg500S_EXT INT8U PCDLoadKey(INT8U KEYAB,INT8U SecNr,INT8U *Key);
Zlg500S_EXT INT8U PCDWriteReg(INT8U RegAddr,INT8U RegValue);
Zlg500S_EXT INT8U PCDReadReg(INT8U RegAddr,INT8U *RegValue);

//声明ISO14443A命令函数
Zlg500S_EXT INT8U PiccRequest(INT8U Req_Code,INT8U *TagType);
Zlg500S_EXT INT8U PiccAnticoll(INT8U Sel_Code,INT8U Bcnt,INT8U *PiccSnr);
Zlg500S_EXT INT8U PiccSelect(INT8U Sel_Code,INT8U *PiccSnr,INT8U *Sak);
Zlg500S_EXT INT8U PiccHalt();
Zlg500S_EXT INT8U PiccAuthE2(INT8U KeyAB,INT8U *PiccSnr,INT8U SecNr,INT8U Block);
Zlg500S_EXT INT8U PiccAuthKey(INT8U KeyAB,INT8U *PiccSnr,INT8U *Key,INT8U Block);
Zlg500S_EXT INT8U PiccRead(INT8U Block,INT8U *Bfr);
Zlg500S_EXT INT8U PiccWrite(INT8U Block,INT8U *Bfr);
Zlg500S_EXT INT8U PiccULWrite(INT8U Block,INT8U *Bfr);
Zlg500S_EXT INT8U PiccValue(INT8U Mode,INT8U Block,INT8U *Value,INT8U TransBlock);
Zlg500S_EXT INT8U PiccReset(INT8U _1ms);
Zlg500S_EXT INT8U PiccActiveTypeA(	INT8U BaudRate,
									INT8U Req_Code,
									INT8U *Atq,
									INT8U *Ats,
									INT8U *PiccSnrLen,
									INT8U *PiccSnr	);
#if PiccAutoDetect_en
Zlg500S_EXT INT8U PiccAutoDetect(INT8U OutMode,  INT8U TxMode, INT8U Req_Code, 
					 				INT8U AuthMode, INT8U KEYAB,  INT8U *Key, INT8U Block);
#define ADSERIALOUT		0x01	//串口主动输出
#define ADINTENABLE		0x02	//中断使能
#define ADCONTINUE		0x04	//串口输出之后继续检测
#define ADHALT			0x08	//最后将卡挂起
#define ADTXALERT		0x00	//TX1,TX2交替输出
#define ADONLYTX1		0x01	//仅TX1输出
#define ADONLYTX2		0x02	//仅TX2输出
#define ADALLTX			0x03	//TX1,TX2同时输出
#endif

Zlg500S_EXT INT8U PiccADRcv(INT8U *TxDrv,INT8U *TagType,INT8U *Sak,INT8U *Snr,INT8U *DTBfr);	//若DTBfr为空,则表示不读扇区数据

#if PiccReadADDT_en
Zlg500S_EXT INT8U PiccReadADDT(INT8U Mode,INT8U *TxDrv,INT8U *TagType,INT8U *Sak,INT8U *Snr,INT8U *DTBfr);	//若DTBfr为空,则表示不读扇区数据
#define ADRFU			0x00
#define ADREENABLE		0x01
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -