PcdRequest.c
上传用户:hbtfgg
上传日期:2021-12-10
资源大小:16k
文件大小:1k
源码类别:

RFID编程

开发平台:

C/C++

  1. #include <reg52.h>
  2. #include "rc500.h"
  3. char PcdRequest(uchar req_code)
  4. {
  5.    char status;
  6.    idata struct TranSciveBuffer {uchar MfCommand;
  7.                                  uchar MfLength;
  8.                                  uchar MfData[1];
  9.                                 }MfComData;
  10.    struct TranSciveBuffer *pi;
  11.    pi=&MfComData;
  12.    PcdSetTmo(106);
  13.    WriteRC(RegChannelRedundancy,0x03);
  14.    ClearBitMask(RegControl,0x08);
  15.    WriteRC(RegBitFraming,0x07);
  16.    MfComData.MfCommand=PCD_TRANSCEIVE;
  17.    MfComData.MfLength=1;
  18.    MfComData.MfData[0]=req_code;
  19.    status=PcdComTransceive(pi);
  20.    if(!status)
  21.    {    if(MfComData.MfLength!=0x10)
  22.         {
  23.          status=MI_BITCOUNTERR;
  24.         }
  25.    }
  26.    return status;
  27. }