PcdSelect.c
资源名称:RC500.rar [点击查看]
上传用户:hbtfgg
上传日期:2021-12-10
资源大小:16k
文件大小:1k
源码类别:
RFID编程
开发平台:
C/C++
- #include <reg52.h>
- #include "rc500.h"
- char PcdSelect(uchar *snr)
- {
- uchar i;
- char status;
- uchar snr_check=0;
- idata struct TranSciveBuffer{uchar MfCommand;
- uchar MfLength;
- uchar MfData[7];
- }MfComData;
- struct TranSciveBuffer *pi;
- pi=&MfComData;
- PcdSetTmo(106);
- WriteRC(RegChannelRedundancy,0x0F);
- ClearBitMask(RegControl,0x08);
- MfComData.MfCommand=PCD_TRANSCEIVE;
- MfComData.MfLength=7;
- MfComData.MfData[0]=PICC_ANTICOLL1;
- MfComData.MfData[1]=0x70;
- for(i=0;i<4;i++)
- {
- snr_check^=*(snr+i);
- MfComData.MfData[i+2]=*(snr+i);
- }
- MfComData.MfData[6]=snr_check;
- status=PcdComTransceive(pi);
- if(status==MI_OK)
- { if(MfComData.MfLength!=0x8)
- {
- status = MI_BITCOUNTERR;
- }
- }
- return status;
- }