⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rccommunication.c

📁 RC500的mifare卡开发备用程序及电路
💻 C
字号:
#include <RcCommunication.h>
#include <MfErrNo.h>
#include <CPURegs.h>

///////////////////////////////////////////////////////////////////////////////
//                 Module Definitions
///////////////////////////////////////////////////////////////////////////////
#ifndef GetRegPage
 #define GetRegPage(adr) (0x80 | (adr>>3))
#endif

unsigned char * const gpcRCBaseAddress = (unsigned char * const)(MEMORY_BASE_ADDRESS);


  
///////////////////////////////////////////////////////////////////////////////
//                 Open Reader Communication
///////////////////////////////////////////////////////////////////////////////
char OpenRC(void)
{
   signed char status = MI_OK;


   	READER_INIT_RESET;

   return status;
}

///////////////////////////////////////////////////////////////////////////////
//                 Close Reader Communication
///////////////////////////////////////////////////////////////////////////////
void CloseRC(void)
{
}


///////////////////////////////////////////////////////////////////////////////
//          GENERIC    WRITE
///////////////////////////////////////////////////////////////////////////////
void WriteRC(unsigned char Address, unsigned char value)
{
   WriteRawRC(0x00,GetRegPage(Address));   // select appropriate page
   WriteRawRC(Address,value);              // write value at the specified 
                                           // address
}

///////////////////////////////////////////////////////////////////////////////
//          GENERIC    READ
///////////////////////////////////////////////////////////////////////////////
unsigned char ReadRC(unsigned char Address)
{

   WriteRawRC(0x00,GetRegPage(Address));   // select appropriate page
   return ReadRawRC(Address);              // read value at the specified 
   
}  

///////////////////////////////////////////////////////////////////////////////
//     WRITE   SEVERAL   MEMORY   LOCATIONS 
///////////////////////////////////////////////////////////////////////////////
void WriteRCMultiple(unsigned char *Addr_Data, unsigned short len)
{
   static unsigned short cnt;

   for (cnt = 0; cnt < len; cnt++)
   {
       WriteRawRC(0x00,GetRegPage(Addr_Data[cnt*2]));// select appropriate page
        // write value at the specified address
       WriteRawRC(Addr_Data[cnt*2],Addr_Data[cnt * 2 + 1]); 
   }
}

///////////////////////////////////////////////////////////////////////////////
//     READ   SEVERAL   MEMORY   LOCATIONS 
///////////////////////////////////////////////////////////////////////////////
void ReadRCMultiple(unsigned char* Addr_Data, unsigned short len)
{
   static unsigned short cnt;

   for (cnt = 0; cnt < len; cnt++)
   {
       WriteRawRC(0x00,GetRegPage(Addr_Data[cnt*2]));// select appropriate page
       Addr_Data[cnt*2 + 1] = ReadRawRC(Addr_Data[cnt*2]);// read value at the 
                                                      // specified address
   }
}  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -