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

RFID编程

开发平台:

C/C++

  1. #include<reg52.h>
  2. #include<rc500.h>
  3. void PcdSetTmo(uchar tmoLength)
  4. {
  5.    switch(tmoLength)
  6.    {  
  7.       case 1:                             // short timeout (1,0 ms)
  8.          WriteRC(RegTimerClock,0x07);     // TAutoRestart=0,TPrescale=128
  9.          WriteRC(RegTimerReload,0x6a);    // TReloadVal = 'h6a =106(dec)
  10.          break;
  11.       case 2:                             // medium timeout (1,5 ms)
  12.          WriteRC(RegTimerClock,0x07);     // TAutoRestart=0,TPrescale=128
  13.          WriteRC(RegTimerReload,0xa0);    // TReloadVal = 'ha0 =160(dec)
  14.          break;
  15.       case 3:                              // long timeout (6 ms)
  16.          WriteRC(RegTimerClock,0x09);      // TAutoRestart=0,TPrescale=4*128
  17.          WriteRC(RegTimerReload,0xa0);     // TReloadVal = 'ha0 =160(dec)
  18.          break;
  19.       case 4:                              // long timeout (9.6 ms)
  20.          WriteRC(RegTimerClock,0x09);      // TAutoRestart=0,TPrescale=4*128
  21.          WriteRC(RegTimerReload,0xff);     // TReloadVal = 'ff =255(dec)
  22.          break;
  23.       default:                             // short timeout (1,0 ms)
  24.          WriteRC(RegTimerClock,0x07);      // TAutoRestart=0,TPrescale=128
  25.          WriteRC(RegTimerReload,tmoLength);// TReloadVal = tmoLength
  26.          break;
  27.    }
  28.    WriteRC(RegTimerControl,0X06);
  29. }