PcdRead.c
上传用户:hbtfgg
上传日期:2021-12-10
资源大小:16k
文件大小:1k
- #include<reg52.h>
- #include<rc500.h>
- char PcdRead(uchar addr,uchar *readdata)
- {
- char status;
- uchar i;
- idata struct TranSciveBuffer{uchar MfCommand;
- uchar MfLength;
- uchar MfData[16];
- }MfComData;
- struct TranSciveBuffer *pi;
- pi=&MfComData;
- PcdSetTmo(4);
- WriteRC(RegChannelRedundancy,0x0F);
- MfComData.MfCommand=PCD_TRANSCEIVE;
- MfComData.MfLength=2;
- MfComData.MfData[0]=PICC_READ;
- MfComData.MfData[1]=addr;
- status=PcdComTransceive(pi);
- if(status==MI_OK)
- {
- if(MfComData.MfLength!=0x80)
- {
- status = MI_BITCOUNTERR;
- }
- else
- {
- for(i=0;i<16;i++)
- {
- *(readdata+i)=MfComData.MfData[i];
- }
- }
- }
- return status;
- }