• 永立
    了解作者
  • C/C++
    开发工具
  • 179KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 127
    下载次数
  • 2011-05-25 14:49
    上传日期
开发板中带的rc500的源码,单片机是STC的,绝对可用,已实际测试过。
rc500.rar
  • 图书信息采集系统程序(2010-11-13)
  • TEST5.LST
    426B
  • MfErrNo.h
    2.9KB
  • LCD_W25x80.OBJ
    37.4KB
  • RC500LCD_Opt.Bak
    3.1KB
  • RC500LCD_Uv2.Bak
    2.1KB
  • LCD_W25x80.C
    16.3KB
  • RC500 LCD.M51
    102.3KB
  • STC12C_EEPROM.c
    4KB
  • RC500LCD
    111.3KB
  • RC500&&LCD.plg
    13.9KB
  • M500AuC.h
    4.2KB
  • RC500&&LCD_Uv2.Bak
    2KB
  • RC500LCD.Uv2
    2.1KB
  • RC500LCD.lnp
    47B
  • RC500LCD.Opt
    3.1KB
  • LCD_W25x80.LST
    32.2KB
  • LCD_Driver.h
    725B
  • RC500LCD.plg
    222B
  • M500AuC.LST
    92.6KB
  • font.c
    10.4KB
  • W25X80_Flash.h
    615B
  • RC500LCD.M51
    116.2KB
  • RC500LCD.hex
    35KB
  • M500AuC.c
    52.3KB
  • REG52.H
    2.9KB
  • LCD W15x80.LST
    456B
  • M500AuC.OBJ
    133.1KB
  • RC500&&LCD.Opt
    1.2KB
  • RC500&&LCD.lnp
    63B
  • RC500&&LCD_Opt.Bak
    1.2KB
  • Mfreg500.h
    3.6KB
内容介绍
#define M500_GLOBALS #define songti 0x00l #define heiti 0x40650l #define kaiti 0x804A0l #define yuanti 0xC02F0l //#include <absacc.h rel='nofollow' onclick='return false;'> #include "INTRINS.H" #include "stdio.h" #include "string.h" #include "REG52.H" #include "Mfreg500.h" #include "MfErrNo.h" #include "M500AuC.h" //#include "Lcd_Driver.h" //#include "W25X80_Flash.h" #include "LCD_W25x80.c" #include "STC12C_EEPROM.c" #define GetRegPage(addr) (0x80 | (addr>>3)) #define nocard 0 #define mifare1 1 #define mifarepro 2 #define mifarelight 3 #define unknowncard 4 #define NO_TIMER2 1 #define uchar unsigned char #define uint unsigned int bit keyFlag=0,readFlag,S1_Flag=0,S2_Flag=0,LCD_Clr_Flag=0; uchar xdata rev[96*2]={0}; //uchar xdata info[5][48]={0}; uchar *rev0=rev; unsigned char flagcount=0,SectrNO=14,status1=1; //图书信息 struct book { uchar size; //图书信息长度 uchar booknumsize; //图书编号长度 uchar booknum[7]; /*图书编号 */ uchar isbnnum; //图书号总字节数n1 uchar isbn[13]; /*图书号(ISBN号)*/ uchar authnum; //书作者总字节数n3 uchar author[30]; /*图书作者 */ uchar pubnum; //出版社总字节数n4 uchar publisher[30]; /*出版社*/ uchar namenum; //书名总字节数n2 uchar name[50]; /*图书名*/ }; struct book xdata bookinf; //uchar xdata snd[30]; //uchar xdata *rev; //sfr AUXR=0x8e; /*如果不需设置AUXR就不用声明AUXR*/ /////////////////////////////////////////////////////////////////////// // 往一个地址写一个数据 /////////////////////////////////////////////////////////////////////// void WriteRawIO(unsigned char Address,unsigned char value) { //_nop_(); //_nop_(); ALE=0; RC500NCS=1; RC500NWR=1; ALE=1; P0=Address; ALE=0; RC500NCS=0; P0=value; RC500NWR=0; _nop_(); RC500NWR=1; RC500NCS=1; //_nop_(); //_nop_(); } /////////////////////////////////////////////////////////////////////// // 从一个地址读出一个数据 /////////////////////////////////////////////////////////////////////// unsigned char ReadRawIO(unsigned char Address) { unsigned char value; //_nop_(); //_nop_(); ALE=0; RC500NCS=1; RC500NRD=1; ALE=1; P0=Address; ALE=0; RC500NCS=0; P0=0xFF; _nop_(); RC500NRD=0; value=P0; RC500NRD=1; RC500NCS=1; //_nop_(); //_nop_(); return value; } /////////////////////////////////////////////////////////////////////// // 往一个地址写一个数据(EEPROM) /////////////////////////////////////////////////////////////////////// void WriteIO(unsigned char Address, unsigned char value) { WriteRawIO(0x00,GetRegPage(Address)); WriteRawIO(Address,value); } /////////////////////////////////////////////////////////////////////// // 从一个地址读出一个数据(EEPROM) /////////////////////////////////////////////////////////////////////// unsigned char ReadIO(unsigned char Address) { WriteRawIO(0x00,GetRegPage(Address)); return ReadRawIO(Address); } /////////////////////////////////////////////////////////////////////// // 设置定时时间 /////////////////////////////////////////////////////////////////////// void M500PcdSetTmo(unsigned char tmoLength) { switch(tmoLength) { case 1: WriteIO(RegTimerClock,0x07); WriteIO(RegTimerReload,0x6a); break; case 2: WriteIO(RegTimerClock,0x07); WriteIO(RegTimerReload,0xa0); break; case 3: WriteIO(RegTimerClock,0x09); WriteIO(RegTimerReload,0xa0); break; case 4: WriteIO(RegTimerClock,0x09); WriteIO(RegTimerReload,0xff); break; case 5: WriteIO(RegTimerClock,0x0b); WriteIO(RegTimerReload,0xff); break; case 6: WriteIO(RegTimerClock,0x0d); WriteIO(RegTimerReload,0xff); break; case 7: WriteIO(RegTimerClock,0x0f); WriteIO(RegTimerReload,0xff); break; default: WriteIO(RegTimerClock,0x07); WriteIO(RegTimerReload,tmoLength); break; } } /////////////////////////////////////////////////////////////////////// // Request Command defined in ISO14443(Mifare) /////////////////////////////////////////////////////////////////////// char M500PcdCmd(unsigned char cmd,volatile unsigned char data *rcv,MfCmdInfo idata *info) { char idata status = MI_OK; char idata tmpStatus ; unsigned char idata lastBits; unsigned int idata timecnt = 0; unsigned char idata irqEn = 0x00; unsigned char idata waitFor = 0x00; unsigned char idata timerCtl = 0x00; WriteIO(RegInterruptEn,0x7F); WriteIO(RegInterruptRq,0x7F); WriteIO(RegCommand,PCD_IDLE); FlushFIFO(); MpIsrInfo = info; MpIsrOut = rcv; info->irqSource = 0x00; switch(cmd) { case PCD_IDLE: irqEn = 0x00; waitFor = 0x00; break; case PCD_WRITEE2: irqEn = 0x11; waitFor = 0x10; break; case PCD_READE2: irqEn = 0x07; waitFor = 0x04; break; case PCD_LOADCONFIG: case PCD_LOADKEYE2: case PCD_AUTHENT1: irqEn = 0x05; waitFor = 0x04; break; case PCD_CALCCRC: irqEn = 0x11; waitFor = 0x10; break; case PCD_AUTHENT2: irqEn = 0x04; waitFor = 0x04; break; case PCD_RECEIVE: info->nBitsReceived = -(ReadIO(RegBitFraming) >> 4); irqEn = 0x06; waitFor = 0x04; break; case PCD_LOADKEY: irqEn = 0x05; waitFor = 0x04; break; case PCD_TRANSMIT: irqEn = 0x05; waitFor = 0x04; break; case PCD_TRANSCEIVE: info->nBitsReceived = -(ReadIO(RegBitFraming) >> 4); irqEn = 0x3D; waitFor = 0x04; break; default: status = MI_UNKNOWN_COMMAND; } if (status == MI_OK) { irqEn |= 0x20; waitFor |= 0x20; timecnt=2300; WriteIO(RegInterruptEn,irqEn | 0x80); WriteIO(RegCommand,cmd); while (!(MpIsrInfo->irqSource & waitFor||!(timecnt--))); WriteIO(RegInterruptEn,0x7F); WriteIO(RegInterruptRq,0x7F); SetBitMask(RegControl,0x04); WriteIO(RegCommand,PCD_IDLE); if (!(MpIsrInfo->irqSource & waitFor)) { status = MI_ACCESSTIMEOUT; } else { status = MpIsrInfo->status; } if (status == MI_OK) { if (tmpStatus = (ReadIO(RegErrorFlag) & 0x17)) { if (tmpStatus & 0x01) { info->collPos = ReadIO(RegCollPos); status = MI_COLLERR; } else { info->collPos = 0; if (tmpStatus & 0x02) { status = MI_PARITYERR; } } if (tmpStatus & 0x04) { status = MI_FRAMINGERR; } if (tmpStatus & 0x10) {
评论
    相关推荐
    • RC500.rar
      自己理解最简单的RC500程序。可以简单寻卡,验证,读写。对理解RC500流程有帮助。
    • RC500.rar
      51单片机考勤系统下位机程序,可以配合上位机软件实现考勤功能,将hex文件下载到51单片机即可使用
    • rc500.zip
      stc89c55 controls the RF chip RC500
    • RC500.rar
      IC card读卡,开发平台KeilUv4,芯片STC89C54RD+,读卡芯片MFRC500
    • RC500.rar
      单片机STC89C51控制RC500读卡、写卡操作,每次卡片上的数据+1计数
    • RC500.rar
      烧写程序进STC单片机控制RC500进行读卡操作,
    • RC500.rar
      RC500测试代码,测试RC500模块-测试代码-配合上位机软件(2013-03-01)
    • stc12 rc522.rar
      在网上找stc12能用rc522例程都没有,自己汇总整理的可以用。而且将rc522的51驱动库进行了重新整理,更加容易读懂
    • STC89C52RC.rar
      STC89C52RC LCD1602 code
    • Proteus7.12.rar
      Proteus7.12完美破解版.rar电路仿真软件很好用可以仿真单片数字模拟电路