PcdSetTmo.c
资源名称:RC500.rar [点击查看]
上传用户:hbtfgg
上传日期:2021-12-10
资源大小:16k
文件大小:1k
源码类别:
RFID编程
开发平台:
C/C++
- #include<reg52.h>
- #include<rc500.h>
- void PcdSetTmo(uchar tmoLength)
- {
- switch(tmoLength)
- {
- case 1: // short timeout (1,0 ms)
- WriteRC(RegTimerClock,0x07); // TAutoRestart=0,TPrescale=128
- WriteRC(RegTimerReload,0x6a); // TReloadVal = 'h6a =106(dec)
- break;
- case 2: // medium timeout (1,5 ms)
- WriteRC(RegTimerClock,0x07); // TAutoRestart=0,TPrescale=128
- WriteRC(RegTimerReload,0xa0); // TReloadVal = 'ha0 =160(dec)
- break;
- case 3: // long timeout (6 ms)
- WriteRC(RegTimerClock,0x09); // TAutoRestart=0,TPrescale=4*128
- WriteRC(RegTimerReload,0xa0); // TReloadVal = 'ha0 =160(dec)
- break;
- case 4: // long timeout (9.6 ms)
- WriteRC(RegTimerClock,0x09); // TAutoRestart=0,TPrescale=4*128
- WriteRC(RegTimerReload,0xff); // TReloadVal = 'ff =255(dec)
- break;
- default: // short timeout (1,0 ms)
- WriteRC(RegTimerClock,0x07); // TAutoRestart=0,TPrescale=128
- WriteRC(RegTimerReload,tmoLength);// TReloadVal = tmoLength
- break;
- }
- WriteRC(RegTimerControl,0X06);
- }