473,748 Members | 8,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extracting RFID Tag's CRC Hex value using VB 6.0

3 New Member
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 4158
VictorTan
3 New Member
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
VictorTan
3 New Member
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
1602
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, <tag>My Data Here</tag>. I've tried using the <xsl:value-of select="tag"/> element, but it does not appear to work in schema files. Is this correct? Is there another way to get at this data? -James
2
7121
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 reasources about using RFID, like how do i capture the tag ID using the reader and passing it into my application. Thanks.
1
2262
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, http://flying-rugs.com/rfid-tutorial/
1
3132
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 http://www.ti.com/rfid/docs/manuals/refmanuals/S6000ProgramLibraryFECOM.pdf og http://www.ti.com/rfid/docs/manuals/refmanuals/S6000ProgramLibraryFEISC.pdf
1
4516
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 following is the program which is written in ZPL language: ^XA ^LH30,30 ^F020,10^AD^FDZEBRA^FS ^F020,60^B3^FDSMITHA NARENDRA^FS ^XZ
2
7288
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 RFID tags.I don't even have a clue. so please help me.If possible send me an example code, otherwise please atleast give me some clues.
1
2634
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 ^FO20,120^A0N,60^FN0^FS ^HV0,,Tag ID:^FS
4
10348
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 Bluetooth as I can do from Control Panel ("Network and dialup connections" and "Power"). Googling I've found that I should:
0
1224
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?
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.