西部数码网站管理助手 没有d盘搜索引擎是软件还是网站
ISO14443A部分代码
ISO14443对应的是普通IC卡,即通称的大白卡。
通讯部分代码:
/
//功 能:通过RC522和ISO14443卡通讯
//参数说明:Command[IN]:RC522命令字
// pInData[IN]:通过RC522发送到卡片的数据
// InLenByte[IN]:发送数据的字节长度
// pOutData[OUT]:接收到的卡片返回数据
// *pOutLenBit[OUT]:返回数据的位长度
/
char PcdComMF522(u8 Command, u8 *pInData, u8 InLenByte,u8 *pOutData, u16 *pOutLenBit)
{char status = MI_ERR;u8 irqEn = 0x00;u8 waitFor = 0x00;u8 lastBits;volatile u8 n;volatile u16 i;switch (Command){case PCD_AUTHENT:irqEn = 0x12;waitFor = 0x10;break;case PCD_TRANSCEIVE:irqEn = 0x77;waitFor = 0x30;break;default:break;}SPI_WriteByte(ComIEnReg,irqEn|0x80);ClearBitMask(ComIrqReg,0x80);SPI_WriteByte(CommandReg,PCD_IDLE);SetBitMask(FIFOLevelReg,0x80);for(i=0; i<InLenByte; i++){ SPI_WriteByte(FIFODataReg, pInData[i]); }SPI_WriteByte(CommandReg, Command);if(Command == PCD_TRANSCEIVE){ SetBitMask(BitFramingReg,0x80);}// i = 600;//根据时钟频率调整,操作M1卡最大等待时间25msi = 20000;do{n = SPI_ReadByte(ComIrqReg);i--;}while ((i!=0) && !(n&0x01) && !(n&waitFor));ClearBitMask(BitFramingReg,0x80); if (i!=0){if(!(SPI_ReadByte(ErrorReg)&0x1B)){status = MI_OK; if(n & irqEn & 0x01){ status = MI_NOTAGERR; }if(Command == PCD_TRANSCEIVE){n = SPI_ReadByte(FIFOLevelReg);lastBits = SPI_ReadByte(ControlReg) & 0x07;if (lastBits){ *pOutLenBit = (n-1)*8 + lastBits; }else{ *pOutLenBit = n*8; }if (n == 0){ n = 1; }if (n > MAXRLEN){ n = MAXRLEN; }for (i=0; i<n; i++){ pOutData[i] = SPI_ReadByte(FIFODataReg); }}}else{ status = MI_ERR; }}SetBitMask(ControlReg,0x80); // stop timer nowSPI