Windows Mobile app to read and write RFID TAGs

Print This Post Print This Post


this time I would publish my code for a full blown RFID application: IP4-Scan-N-Tag-BRI. The app is written in C# (compact framework) for the ITC Handheld readers IP4 and IP30 and either ITC 700 color or CN3 devices.

At first, how does the app work in general and look:


The app starts and waits for reading a barcode. Secondly the app looks for a single TAG and thirdly writes the barcode data into the TAG.

The encoding and decoding of the TAGs data is done using a class called vwTag. Please forgive me with all the conversions between hex and binary inside this class, I would like to see how the TAG data looks like during the development cycles.

After you started the app, you will first have to select file-connect reader, so the device will connect with the portable RFID reader (either a IP4 or IP30). When the RFID reader is connected, the applications waits for a barcode. Both portable readers have a pull switch and you just have to trigger it to read a barcode. If the barcode is validated, the application switches to another state, it waits for a single TAG read now. Again just pull the trigger and target the RFID antenna towards a single TAG. If the application finds a single TAG, its data is validated against the encoding scheme in the vwTag class. This avoids reading/writing to unwanted TAGs. If the readed TAG is valid, pull the trigger a third time to write the barcode data into the TAG.

The application uses a ‘state machine’ (I like this nice term) to switch from one state to another. The known states are:

        enum eStatus
            //new with v3
        eStatus CurrentStatus=eStatus.Offline;

As you can see, the app also supports one other feature: Two TAGs mode: the app will read/write two TAGs in parallel with two different BOXids (see vwTag class for the definition of BOXid). In real the app writes the two TAGs one by one, you cannot write two TAGs with different data within one WRITE command.

Here is a snippet from vwTAG class to show you the encoding of the TAG data:

#region version2 comment
    //VERSION 2
    //String:            1J UN 049977473 123456789 ..
    //########### B I N A R Y ###############
    //EPC-Header 00110100
    // Bit 88 to 95
    //Filter 3 Bit       xxx
    // Bit 85 to 87      zzz
    //Partition             110
    // Bit 82 to 84
    //Box-Ident 20 Bit            00000000010000000001
    // Bit 62 to 81
    // NEW: old Filter is renamed to DataID
    //DataID (Data identifier + Agency code)          yy
    // Bit 60 to 61            00 = 1JUN
    //                         01 = 5JUN
    //                         10 = 6JUN
    //                         11 = NDEF
    //Supplier-ID 30 Bit                                000000000100000000010000000001
    // Bit 30 to 59
    //Item-Number 30 Bit                                                              000000000100000000010000000001
    // Bit 0 to 29

    //Binary: 001101000000000000000000000000000100000010111110101001100010000001000111010110111100110100010101
    //string: 101010001011001111011010111000100000010001100101011111010000001000000000000000000000000000101100
    //1J UN 049977473 123456789

The TAG data field and barcode definitions:

Valid TAGs

A valid TAG has following data (highest bit first, ro=readonly, rw=readwrite):

8 Bit EPC-Header:   00110100      ro
Filter:                3 bit      ro      to distinguish two TAGs at the same box.
                                          see also Box-ID
Partition:               011      ro
Box ID:               20 bit      ro      BOX-ID (0- 1048574)
Data ID                2 bit      rw      Data Identifier (1J, 6J oder 6J) and Issuing Agency Code (UN)
SupplierID:           30 bit      rw      Delivery-Identification according to DUNS (0- 1073741822)
ItemNumber:           30 bit      rw      Package Number (0- 1073741822)

Valid Barcodes

License-Plate Barcode A valid Code128-barcode with License-Plate Scheme: Data Id:               1J, 5J or 6J Agency Code:           UN SupplierID:            [9 digits], spaces and hyphens will be ignored ItemNumber:            [9 digits]

Box-ID und TAG-Nr Barcodes

Exactly 5 digits number. First digit for TAG-No 1 or 2. The rest (4 digits) will be used as box number (Box-ID). Barcodetyp has to be Code39.

Source Code (VS 2005, compact framework 2, Mobile 2003):
[Download not found]


  1. Sam says:


    Great website,

    I am working on using Motorola MC9090-G RFID readers running windows mobile ce 6.0 but I am at a loss of finding a free software, would you be able to help guide me in the right direction? also, can I use your code with minor modification.

    Thanks for your help


  2. josef says:

    Hello Sam

    I am sorry, but I do not know any sample for the Motorola but they (now Zebra) have a good support site!


  3. Tran says:

    Hi Sam,

    Motorola has support sample app. You can get it when install EMDK. If you are coder, it is easy to modify to get app.

  4. Sam says:

    Thanks guys, I appreciate your help.

  5. Teja says:

    Hi Sam,

    Did you work on RFID application.

    I am new to RFID application. If you ever worked on this , could you please provide me a sample application.

    I need a simple application where my screen will have one text box and one label. When we scan tag into a text box then we need to show that in label..

    Really appreciate your help…

  6. Andy says:


    Is this source code still available?

  7. josef says:

    Hi Andy

    some Downloads did not survive a plugin update. I will re-upload the code ASAP. Keep an eye on the comments.



Leave a Reply