Click here to Skip to main content
13,299,252 members (44,216 online)
Click here to Skip to main content
Add your own
alternative version


54 bookmarked
Posted 15 Apr 2009

UHF RFID Reader Program

, 15 Apr 2009
Rate this:
Please Sign up or sign in to vote.
900 MHz RFID Reader Tag identification using an RFID Reader.


This is a program for a 900 MHz UHF (Ultra High Frequency) RFID (Radio Frequency Identification). This program must have a Samsung Techwin UHF Handheld RFID Reader (VLAC-G1) or a UHF Fixed RFIDReader (VLAC-Alpha) based InpinJ R1000 chipset.


Many people listen to RFID. This technology has numerous possibilities for the distribution industry, food hygiene, air cargo, public library, etc......

This technology is constructed using an RFID Tag, an RFID Reader, and a Service. The RFID Tag is a very low cost product. Several months ago, Hynix Semiconductors said, "We will make 1 cent RFID tag chips." The RFID Reader is more expensive than RFID tags.

However, this might be perfect for any distribution vendor considering applications for low cost of transport and reliability of transport. And, many food companies might consider its application for food safety. For example, an industry vendor might consider changing from 2D barcode technology to RFID technology.

This program will be very useful for RF tag identification.

RFID Tags Structure

The 900MHz RFID Tags is composed of a tag chip and an antenna. The tag chip is based on the ISO 18000-4 spec for automatic data identification specification and ISO-18000-6C specialization for item level management tags. The latest trend is 18000-6C. We call these Gen2 tags.

The detail structure searches the EPC Global standard. These tags are composed of BANK 00 (Reserved Memory), BANK 01 (EPC Memory), BANK 10 (TID), and BANK 11 (User Memory).

  • The BANK 00 (Reserved memory) is composed of a kill password area and an access password area for secure functions.
  • The BANK 01 (EPC memory) is composed of CRC-16 (tag used when protecting certain R=> T, T => R), PC (Protocol control for EPC memory area), and EPC (Electronic Product Code).
  • The BANK 10 (TID memory) is the 8 bit ISO/IEC 15963 allocation class identifier; 11100010 for EPC Global.
  • The BANK 11 (User memory) is the user specification data storage.

How to Read RFID Tags in this Program

This program is composed of RFID Radio (CRFIDRadio) and RFID Radio Management (CRFIDRadioManager) objects.

The CRFIDRadio object is a real command operator. This object has some functions for the Inventory command, Tag Access (Read/BlockRead/Write/BlockWrite/Lock/Kill) commands, and the RFID setting function. And, this object calls the Samsung Techwin RFID Reader API.

The CRFIDRadioManager object is to manage each RFID Radio object. And, this object controls CRFIDRadio objects for command transport.

First, you must create a CRFIDRadioManager:

// Your application header file.
CRFIDRadioManager m_pRFIDRadioManager;
// Your application source file.
m_pRFIDRadioManager = new CRFIDRadioManager();

and connect to RFID Reader device like this:

m_pRFIDRadioManager->SetParnet(CWnd* Object);
if(m_pRFIDRadioManager->Connect() != RFID_STATUS_OK)
    // Connection fail process
    // Connection success process

This function makes a connection to a CRFIDRadio object. In this state, the CRFIDRadioManager object searches and attaches an RFID Reader device on your accessible RFID Reader using USB, Serial, and TCP/IP interfaces. And, the SetParent function sets the CWnd window for Win32 message returning. This state is a complete reader connection.

Next, you will want identify the RFID tag. Look at the RunInventory function in the CRFIDRadioManager. This function sends tags for the read command to the RFID reader. It creates a thread for the read command.

// Your application
void CMainFrame::OnRfidRunInventory()
    pRFIDRadioManager->RunInventory(0, -1);
// CRFIDRadioManager
RFID_STATUS CRFIDRadioManager::RunInventory(int nModule, INT32 nCount)
    if(m_listRadio.GetCount() > 0)
        POSITION pos = m_listRadio.FindIndex(nModule); // find the radio ojbect
        CRFIDRadio* pRadio = (CRFIDRadio*)m_listRadio.GetAt(pos);
        pRadio->m_nStopCountDown = nCount; // set inventory stop count
        pRadio->m_runStatus = RFID_INVENTORY;
        _oleStartDateTime = COleDateTime::GetCurrentTime();
        Radio->Create(); // create inventory thread
    return status;

The packet parameter is the result information from the reader. The base structure is RFID_PACKET_COMMON. For detailed structure information, see the Interface Specification white paper in the Samsung Techwin homepage.

The CRFIDRadioManager returns the parent CTagInfo object using the SetParent function.

    (RFID_PACKET_18K6C_INVENTORY *)packet;
    /* Calculate the length of the data portion of the packet */
    int length =
    /* The length of the packet beyond the common header */
    (MacToHost16(common->pkt_len)-1) * BYTES_PER_LEN_UNIT -
    /* Add back in the size of the common header */
    (common->flags >> 6);
    if(common->flags & 0x01)
    int padding_byte = (int)(common->flags & 0xC0);
    POSITION pos = m_listRadio.FindIndex(0);
    CRFIDRadio* pRadio = (CRFIDRadio*)m_listRadio.GetAt(pos);
    if(pRadio->m_runStatus != RFID_INVENTORY)
        CString strTemp = TEXT("Tag ID : ");
        CTagInfo lpTagInfo;// = new CTagInfo();
        strTemp += lpTagInfo.GetTagString();
        theApp.m_pMainWnd->SendMessage(WM_TAG_ACCESS, (WPARAM)(LPCTSTR)strTemp, 0);
#ifdef _WIN32_WCE
        if(m_radioBeepMode == RFID_RADIO_BEEP_MODE_ENABLE)
    // Tag Data Process
    CTagInfo* lpTagInfo = new CTagInfo();
ifdef _WIN32_WCE
    if(m_radioBeepMode == RFID_RADIO_BEEP_MODE_ENABLE)
    m_pParent->SendMessage(WM_PROCESS_TAG, (WPARAM)lpTagInfo);

The CTagInfo object copies tag information from the RFID Reader. And, the CTagInfo object reconstructs PC, EPC, and other information using the ISO 18000-6C tag type.

I do type cast from the packet parameter to the RFID_PACKET_18K6C_INVENTORY struct. And, I define the inv variance. I check the packet length and the flag for the right packet type. If the packet is right, I make a CTagInfo object for tag information. Finally, I return a CTagInfo object to the parent object using the SendMessage function. The complete source code is available from the download link above.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Youngho Kim
Software Developer
Korea (Republic of) Korea (Republic of)
I hope to help your coding processing.

You may also be interested in...

Comments and Discussions

QuestionHow can I adapt this code for a 2.4GHZ Active reader? Pin
twelvematic25-Oct-15 23:39
membertwelvematic25-Oct-15 23:39 
QuestionHow to Use the code Pin
Member 103489891-Mar-15 23:14
memberMember 103489891-Mar-15 23:14 
QuestionNeed Executable file Pin
jigish shah27-Feb-14 3:44
memberjigish shah27-Feb-14 3:44 
QuestionRFID READERnesslab Pin
Member 1056352213-Feb-14 4:52
memberMember 1056352213-Feb-14 4:52 
AnswerRe: RFID READERnesslab Pin
Youngho Kim13-Feb-14 13:48
memberYoungho Kim13-Feb-14 13:48 
Questioncode confusion Pin
bhaskar_ams16-Jan-13 18:55
memberbhaskar_ams16-Jan-13 18:55 
Can this code be implemented using Matlab?
AnswerRe: code confusion Pin
Youngho Kim14-Feb-13 14:30
memberYoungho Kim14-Feb-13 14:30 
QuestionGood job Pin
PeymanFx15-Jan-13 21:03
memberPeymanFx15-Jan-13 21:03 
QuestionI need IU9060 SDK Pin
Afshin Hosseini20-Aug-11 22:11
memberAfshin Hosseini20-Aug-11 22:11 
QuestionPlease Help Me Mr Kim Pin
jalalsavber19-Aug-11 6:41
memberjalalsavber19-Aug-11 6:41 
GeneralMy vote of 4 Pin
Sikindar11-Apr-11 16:16
memberSikindar11-Apr-11 16:16 
GeneralMy vote of 5 Pin
fitr14n18-Oct-10 8:55
memberfitr14n18-Oct-10 8:55 
GeneralRe: My vote of 5 Pin
Youngho Kim3-Jan-11 5:23
memberYoungho Kim3-Jan-11 5:23 
GeneralRFID C# Library Pin
ochaves5-Jan-10 12:23
memberochaves5-Jan-10 12:23 
GeneralRe: RFID C# Library Pin
Youngho Kim5-Jan-10 13:17
memberYoungho Kim5-Jan-10 13:17 
GeneralRe: RFID C# Library Pin
ochaves6-Jan-10 5:18
memberochaves6-Jan-10 5:18 
GeneralRe: RFID C# Library Pin
Youngho Kim6-Jan-10 14:31
memberYoungho Kim6-Jan-10 14:31 
GeneralRe: RFID C# Library Pin
Youngho Kim28-Apr-11 19:20
memberYoungho Kim28-Apr-11 19:20 
GeneralRFID Pin
abhishek amar22-Nov-09 4:13
memberabhishek amar22-Nov-09 4:13 
GeneralRe: RFID Pin
Youngho Kim27-Nov-09 20:49
memberYoungho Kim27-Nov-09 20:49 
Questionrfid UHF Fixed Reader SRU-FK0100 Pin
jflee15-Oct-09 6:44
memberjflee15-Oct-09 6:44 
AnswerRe: rfid UHF Fixed Reader SRU-FK0100 Pin
Youngho Kim15-Oct-09 14:33
memberYoungho Kim15-Oct-09 14:33 
GeneralRe: rfid UHF Fixed Reader SRU-FK0100 Pin
jflee16-Oct-09 7:45
memberjflee16-Oct-09 7:45 
GeneralRe: rfid UHF Fixed Reader SRU-FK0100 Pin
Youngho Kim18-Oct-09 15:11
memberYoungho Kim18-Oct-09 15:11 
GeneralRe: rfid UHF Fixed Reader SRU-FK0100 Pin
jflee18-Oct-09 17:04
memberjflee18-Oct-09 17:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 15 Apr 2009
Article Copyright 2009 by Youngho Kim
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid