473,378 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Extracting RFID Tag's CRC Hex value using VB 6.0

Hello. I'm new to this forum. Hope that I don't make mistakes in here but if I do, please correct me if there is. Thanks.

I also wanted to ask you guys regarding about the following following source codes I'm going to post it here as I did a search here and did not find any question related to mine.

I'm doing an automatic inventory control system using RFID project and I'm instructed to extract the RFID transponder's ID and CRC and display it onto the form I've created using Visual Basic 6.0 before I touch up on the database portion which I need not need to worry much about. I managed to get the program to extract the transponder's ID and display it onto the textbox but I'm having problems extracting the CRC Hex value I'm not sure which part of the code I'm suppose to addon (See below).

Expand|Select|Wrap|Line Numbers
  1. Public Sub Display_Msg(sMsg As String)
  2.  
  3.    frmMain.txtDisplay.Text = frmMain.txtDisplay.Text + sMsg
  4.  
  5. End Sub
  6.  
  7. Public Function Hex2Str(Hex_String As String) As String
  8.     Dim iPos As Integer
  9.     Dim iTemp As Integer
  10.     Dim sMsg As String
  11.     Dim b As String
  12.     Dim gPos As Integer
  13.     Dim g As String
  14.  
  15.  
  16.    For iPos = 8 To Len(Hex_String) - 2
  17.         iTemp = Asc(Mid$(Hex_String, iPos, 2))
  18.  
  19.         If iTemp < 17 Then sMsg = sMsg + "0"
  20.             g = iTemp
  21.             b = b & Chr$(g)
  22.             sMsg = sMsg + Hex(iTemp) + " "
  23.  
  24.    Next iPos
  25.  
  26.  
  27.         frmMain.txtDisplay.Text = frmMain.txtDisplay.Text & _
  28.             "PC -> Reader: 07 FF B0 01 00 1C 56" & vbCrLf
  29.  
  30.         frmMain.txtDisplay.Text = frmMain.txtDisplay.Text & _
  31.             "PC <- Reader: " & sMsg & vbCrLf
  32.         taginput_crc = frmMain.txtDisplay.Text
  33.  
  34.         frmMain.txtDisplay.Text = taginput_crc & _
  35.             "PC <- Reader: 11 FF B0 23 01 " & sMsg & "00 01 " & vbCrLf & vbCrLf
  36.  
  37.         frmMain.MSComm1.Output = Chr$(&H11) + Chr$(&HFF) + Chr$(&HB0) & _
  38.             Chr$(&H23) + Chr$(&H1) + sMsg + Chr$(&H0) + Chr$(&H1) & _
  39.             frmMain.Text2.Text
  40.  
  41.         frmMain.txtDisplay.Text = taginput_crc & _
  42.             "PC -> Reader: 11 FF B0 23 01 " & sMsg & "00 01 " & frmMain.Text2.Text & vbCrLf & vbCrLf
  43.  
  44.  
  45.         frmShoes.txtShoeTag.Text = "11 FF B0 23 01" & sMsg + "00 01"
  46.         frmShirt.txtShirtTag.Text = "11 FF B0 23 01" & sMsg + "00 01"
  47.  
  48.  
  49.         sbuffer = Chr$(&H11) + Chr$(&HFF) + Chr$(&HB0) + Chr$(&H23) + Chr$(&H1) + b + Chr$(&H0) + Chr$(&H1)
  50.  
  51.         crc_output = CalcCRC16CheckSum(sbuffer, Len(sbuffer))
  52.  
  53.         buflen = Len(sbuffer)
  54.         frmMain.Text1.Text = Len(sbuffer)
  55.  
  56. End Function
And also for example, if my CRC value is "D1B8" which isn't correct as the program calculates D1 as MSB and B8 as LSB, what must be edited to obtain the CRC value "B8D1" as this is actually the correct value (see below)?

Expand|Select|Wrap|Line Numbers
  1. Public Function CalcCRC16CheckSum(sbuffer As String, buflen As Byte) As Integer
  2.  
  3.     Dim i, j As Byte
  4.     Dim wCrc As Integer
  5.     Initialise_mPower
  6.     wCrc = CRC16_PRESET
  7.  
  8.     For i = 1 To buflen
  9.  
  10.         wCrc = wCrc Xor Asc(Mid$(sbuffer, i, 1))
  11.         For j = 1 To 8
  12.             If (wCrc And &H1) Then
  13.                 wCrc = LShift(wCrc, 1) Xor POLYNOM
  14.             Else
  15.                 wCrc = LShift(wCrc, 1)
  16.             End If
  17.         Next j
  18.     Next i
  19.  
  20.     crc_output = wCrc
  21.  
  22.     frmMain.crcdisplay.Text = crc_output
  23.     a = Hex(crc_output)
  24.     frmMain.Text2.Text = a
  25.  
  26. End Function
  27.  
  28. Public Function LShift(ivalue As Integer, iBits As Integer) As Integer
  29.  
  30.     If (ivalue And mPower2(15)) = mPower2(15) Then
  31.         LShift = (ivalue And &H7FFF) \ mPower2(iBits) Or mPower2(15 - iBits)
  32.     Else
  33.         LShift = ivalue \ mPower2(iBits)
  34.     End If
  35.  
  36. End Function
  37.  
  38. Public Function RShift(ivalue As Integer, iBits As Integer) As Integer
  39.  
  40.     If (ivalue And mPower2(15 - iBits)) = mPower2(15 - iBits) Then
  41.         RShift = (ivalue And (mPower2(15 - iBits) - 1)) * mPower2(iBits) Or mPower2(15)
  42.     Else
  43.         RShift = (ivalue And (mPower2(15 - iBits) - 1)) * mPower2(iBits)
  44.     End If
  45.  
  46. End Function
Sorry if I posted a big chunk of code in here as I'm unsure of which portion of the code I'm suppose to look into.

Thanks for the help.
Jun 8 '07 #1
2 4123
I assuming that nobody could answer this? I have been waiting for a reply on this since last week. Thanks again.
Jun 11 '07 #2
Can't anyone help? If can't please let me know. Thank you.
Jun 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Porthos | last post by:
Hi All, I've been working on mining data from a schema file (all attribute data so far) and have come to the point where I need to get information that is contained in tags. For instance,...
2
by: kies | last post by:
Hi all, I'm currently trying to create an application that make use of the RFID technology and i'm not too sure how to get about using the RFID. I was wondering if any of you guys know of any good...
1
by: broadbandera | last post by:
RFID Technology and Architecture, RFID Standards,RFID Applications, RFID Security, Impact of RFID Tags on Recycling, Environmental Challenges of RFID, RFID Tags: Advantages and Limitations, ...
1
by: Peter Hansen | last post by:
Im on a RFID application, in have a lot of problems, which I hope you kan help me with. Sourcefiles: http://www.ti.com/rfid/docs/manuals/softwares/DLL.zip Documentation...
1
by: rsaikamesh | last post by:
Hi, I have connected RFID printer(Zebra R2844-Z) to serial port(dev/ttyS0). My OS is linux(ubuntu). I am using minicom for communication. I need to print some data using the RFID printer. the...
2
by: rsaikamesh | last post by:
Hi, I have connected RFID printer(Zebra R2844-Z) to the serial port(dev/ttyS0). My OS is linux(ubuntu). I need to read the RFID tag using a c++ program.I don't know anything about how to read...
1
by: rsaikamesh | last post by:
Hi, I have connected RFID printer(Zebra R2844-Z) to the serial port(/dev/ttyS0).My OS is linux(ubuntu). The following is a program which is written in ZPL: ^XA ^RI0,,5^FS...
4
by: BLUE | last post by:
Psion WorkAbout Pro with Windows CE .NET 4.2 Dealer gave me PowerAPIOn.exe and PowerAPIOff.exe to turn on/off tag reader, but I want to do it programmatically and do the same with WiFi and...
0
by: amgold | last post by:
i am a beginner i would like to know how to write a programme that will transfer information from an RFID tag to a MS access database and also is it possible to intergrate ms access to ms project?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.