char M531PiccRequestB(unsigned char req_code,
unsigned char AFIB,
unsigned char N,
unsigned char *ATQB)
{
char status;
unsigned int unLen;
unsigned char ucComMF522Buf[MAXRLEN];
ClearBitMask(RegControl,0x08); // disable crypto 1 unit
//WriteRawRC(RegDecoderControl,0x28);
//WriteRawRC(RegBitFraming,0x07);
//WriteRawRC(RegChannelRedundancy,0x2C);
//SetBitMask(RegTxControl,0x03); // Tx2RF-En, Tx1RF-En enable
PcdSetTmo(5);
ucComMF522Buf[0] = ISO14443B_AN
tiCOLLISION; // APf code
ucComMF522Buf[1] = AFIB; //
ucComMF522Buf[2] = ((req_code<<3)&0x08) | (N&0x07); // PARAM
status = PcdComMF522(PCD_TRANSCEIVE,ucComMF522Buf,3,ucComMF522Buf,&unLen);
if (status!=MI_OK && status!=MI_NOTAGERR)
{ status = MI_COLLERR; }
if (unLen != 96)
{ status = MI_COM_ERR; }
if (status == MI_OK)
{
memcpy(ATQB,&ucComMF522Buf[0], 16);
PcdSetTmo(ATQB[11]>>4); // set FWT
}
return status;
}
以上是我初始化完之后直接请求读取那个12个字节的函数,但是总是没应答,不知道什么原因,我初始化应该没什么大问题,手册我也阅读了好几遍了,有用过的指教,谢谢了……
一周热门 更多>