Wednesday, February 27, 2013

Download C Source Code for Radio Frequency Identification RFID Module Interface MCS51

Robometricschool. - In this time we want to share with you about RFID module that very useful to RF project this day. IN our sharing, we want give you what is RFID, show you schematic diagram RFID module interface microcontroller MSC51 AT89S52, and give you download sample C source code for RFID module interface MCS51.

What is RFID?

Maybe there are many people that not know yet about RFID now. RFID stand for Radio Frequency Identification. RFID is a technology that serves to detect and identify an object through the data transmitted via radio frequency. The system requires a minimum of a tag (which serves as a transponder), a reader (who serves as interrogator), and sebuan antenna (which serves as a coupling device).

One important element in RFID is a data transfer. Data transfer occurs when there is connection between the tag and reader, known as coupling through either an antenna mounted on the tag or reader as illustrated in the following figure 1 below:

Figure 1. The relationship between the tag, reader and antenna

Schematic Diagram RFID Module Interface MCS51 AT89S52

Figure 2. RFID Mode Interface AT89S52 Schematic Diagram

Example C Source Code RFID Module Interface MCS51 AT89S52


////////////////////////////////////////////////////////////
//Test SL025x
//MCS51 source code
////////////////////////////////////////////////////////////  
#include <reg52.h>
#include <string.h>

#define  true     1
#define  false    0

#define  OSC_FREQ        22118400L
#define  TIME0_10ms      65536L - OSC_FREQ/1200L

#define  BOUND4800       256 - 24
#define  BOUND9600       256 - 12
#define  BOUND14400      256 - 8
#define  BOUND19200      256 - 6
#define  BOUND28800      256 - 4
#define  BOUND38400      256 - 3
#define  BOUND57600      256 - 2
#define  BOUND115200     256 - 1

//IO definition
sbit     CARDIN    =    P1^0;                                                    

void InitializeSystem();                                                          
void SendCom(unsigned char *g_cCommand);                                          
void StartTime(unsigned int _MS);                                                 
void StopTime();
char ReadWriteUltralight(void);
char ReadWriteMifareStd(void);

//Command List, preamble + length + command code + data frame
unsigned char code SelectCard[3] =     {0xBA,0x02,0x01 };      
unsigned char code LoginSector0[11] =  {0xBA,0x0A,0x02,0x00,0xAA,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; 
unsigned char code LoginSector1[11] =  {0xBA,0x0A,0x02,0x01,0xAA,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
unsigned char code ReadBlock1[4]   =   {0xBA,0x03,0x03,0x01};                                    
unsigned char code WriteBlock1[20] =   {0xBA,0x13,0x04,0x01,0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF};                               
unsigned char code ReadValue[4]  =     {0xBA,0x03,0x05,0x05}; 
unsigned char code InitializeValue[8] ={0xBA,0x07,0x06,0x04,0x00,0x00,0x00,0x01};                               
unsigned char code IncrementValue[8] = {0xBA,0x07,0x08,0x04,0x00,0x00,0x00,0x20};                               
unsigned char code DecrementValue[8] = {0xBA,0x07,0x09,0x04,0x03,0x00,0x00,0x00};                                         
unsigned char code CopyValue[5] =      {0xBA,0x04,0x0A,0x04,0x05};
unsigned char code ReadULPage5[4] =    {0xBA,0x03,0x10,0x05};                                         
unsigned char code WriteULPage5[8] =   {0xBA,0x07,0x11,0x05,0x11,0x22,0x33,0x44};
unsigned char code TurnOnRedLed[4] =   {0xBA,0x03,0x40,0x01};    
unsigned char code TurnOffRedLed[4] =  {0xBA,0x03,0x40,0x00};            
                          
unsigned char g_ucReceBuf[21];                                     
unsigned char g_ucReceNum;                                         
unsigned char g_ucWatchTime;
unsigned char g_ucCardType;
char g_cStatus;                                      
char g_cErr;

bit   g_bReceOver;                                                
bit   g_bReceReady;
bit   g_bTimeOut;        
                                         
For more complete example C source for RFID Module Interface MCS51 AT89S52, please you take free download with click link below:



0 comments:

Post a Comment

Thank's for your visiting and reading this article, please share your idea with comment here