Home Parallel Port Serial Port USB .NET Webboard I/O Today API Project Link
RFID Interfacing and Rading in Visual C++ Programming
This Article in Thai Version
         
              RFID system be not far thing ourselves many you have might to ever are usable the RFID system in the every day life all right unconsciously .
we come to test the knowledge will with the RFID system prevent too much go up small again the system checks the password by use the radio frequency (RFID) be accepted highly that be the Technology that provide to build the usability at must something indicating difference or the data particularly of individual .
That can work be correct accurate fastness and have the be automatic more than the system checks test the password in other system such as , the password is like The Barcode easy usability and still enhance the capability in additional service alms in commercial .
All side moreover still correspond way saving data computer Technology cause testify expand of the usability RFID/SmartCard develop go up steply jump

RFID shorten from the word that Radio Frequency Identification

             The system that lead to take radio waves comes to are carrier of disease germs waves for uses in data communication between two kind equipment that calls that Tag and read the data (Reader) which be the communication like the wireless by data lead that want to send come to Modulation with radio waves then to export change antenna location way in data receiver .
Loud work plan of the RFID system in picture shows the RFID system applying work .
RFID will have usability character that resemble with the bar code and still can support the requirement varied again that the bar code not can meet .
because of , the bar code is will the system that can read only can not do data location change has on the bar code but of the RFID system can both of read and can key thus we then can modify or do keyying location has in to follow something must something of the user besides RFID system still can can be usable although while the material is thatting move such as while goods is moving on transmitting production belt (Conveyor) or in country some there is using RFID system in value saving changes the expressway by expressway user must not stop a car for pays the service charge expressway.
User has will to stick with a car and will do the communication with read the data change large-sized antenna is thatting set up straight ascent expressway area .
While a car runs to change antenna reads the data will think the service charge and record amount of remainder money appeared automatically or even if the usability in good for record the history or specify the difference of animal one by one the location in the farm the merit of the RFID system bely again and read the data can communicate to change .the medium has varied such as the water is the plastic is sheet glass or the inventory opaques other while the bar code can not.

rfid diagram

program writing for read the data from RFID

           for develop who write a program for read that data must know Command in each the trademark and model , such use Command how which way producer will have the data sure, yes sir.
          which this my article will exemplify of the trademark Omron . by use Visual C++ 6 in program writing reads RFID this group
Which the way contacts with change RS-232 to Comm Port

Start to write a program
Step1
rfid programming1

Step2
rfid programming 2

Step3
rfid programming 3

Step4
rfid programming

Step5
rfid programming 5

Step6
rfid programming 6

Step7
rfid programming 7

Step8
rfid programming 8

Step9
RFID program

Step 10 - Modify Source Code for RFID Reading

10.1  Choose RFID_ProgramDlg.CPP  from that time do line expansion 
                      #include "ComPort.h"
           Put it header
10.2  because of RFID Controller in each the generation that us will use that have function differently in this part only.We seek function come to change in Source Code .

 Choose ComPort.CPP
 After that choose function name is Read
 ให้เข้าไปแก้ไข Command ที่เราจะส่งออกไปทาง Com Port  
 ในที่นี้เป็น RFID controller ของ Omron ซึ่งสามารถหาข้อมูลรายละเอียดได้ในผลิตภัณฑ์นั้นๆ
 
 void CComPort::Read(CString& sResult)
{
    BOOL    bWriteRC;
    BOOL    bReadRC;
    DWORD    iBytesWritten;
    DWORD    iBytesRead;
    DWORD    dwError;
    char    s_WorkOrder[100];
    int        i;
    char    sBuffer[256];
    char    sMsg[512];

    iBytesWritten = 0;
   bWriteRC = WriteFile(m_hCom,"RDA1000010*\r",256,&iBytesWritten,NULL);
  
  if (!bWriteRC || iBytesWritten == 0)
    {
        dwError = GetLastError();
        sprintf(sMsg, "Write of length query failed: RC=%d,"
                "Bytes Written=%d, Error=%d",
                bWriteRC, iBytesWritten, dwError);
        AfxMessageBox(sMsg);       
    }

    memset(&sBuffer,0,sizeof(sBuffer));

     bReadRC = ReadFile(m_hCom, &sBuffer,256, &iBytesRead, NULL);

    if (bReadRC && iBytesRead > 0)
    {
        strncpy(s_WorkOrder,&sBuffer[5],100);
        sResult.Format("%s",s_WorkOrder);
        sResult=sResult.Left(2);  
    }
    else
    {
        sResult = "Read Failed";
        dwError = GetLastError();
       
        sprintf(sMsg, "Read length failed: RC=%d Bytes read=%d, "
                "Error=%d ",
                bReadRC, iBytesRead, dwError);
        AfxMessageBox(sMsg);
       
    }
   


Step 11 - Create Function and Button for RFID Reading

RFID project10

We will get function the name OnOK() which this our button will pretend a button reads RFID . thereafter do writing

void CRFID_ProgramDlg::OnOK()
{
     CString mComport;
     mComport="Com1";
     CComPort* pComPort = new CComPort(mComport);
     CString sResults;
     if (pComPort->Initialize())
       {
          pComPort->Read(sResults);
          GetDlgItem(IDC_EDIT1)->SetWindowText(sResults); 
          pComPort->Terminate();
       }
       else
       {
         sResults = "Setup failed";
         GetDlgItem(IDC_EDIT1)->SetWindowText(sResults); 
        } // end if
    

}
 
Step 12 - Test  Program

RFID program11

สามารถ Download source code ที่นี่



Copyright (c) 2000 thaiio.com all rights reserved. Contact webmaster :webmaster@thaiio.com