Decode/Parse XBee API Frame

I have been looking online and am unable to find an answer.  I would like to decode an XBee API Frame so that I can gather the RF data and store it in a database using Visual Basic.  I am able to get the packet and display it in a text box as it comes from the radio.  

How can I take this data: "7E-00-18-90-00-13-A2-00-40-CA-AF-71-28-E1-01-37-38-2E-36-34-2C-34-31-2E-35-0D-0A-74" and grab "00-13-A2-00-40-CA-AF-71" and then change "37-38-2E-36-34-2C-34-31-2E-35" to read "78.64, 41.5"?
LVL 1
SolveEtCoagula07Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aikimarkCommented:
Let's start our discussion with this code
Sub Q_28774721()
    Dim xb As String
    Dim strWantThis As String
    Dim b() As Byte
    Dim p As Variant
    Dim lngLoop As Long
    
    xb = "7E-00-18-90-00-13-A2-00-40-CA-AF-71-28-E1-01-37-38-2E-36-34-2C-34-31-2E-35-0D-0A-74"
    xb = Left(xb, Len(xb) - 9)
    strWantThis = Mid(xb, 13, 23)
    Debug.Print strWantThis
    
    xb = Mid(xb, InStr(36, xb, "01-") + 3)
    p = Split(xb, "-")
    ReDim b(0 To UBound(p))
    For lngLoop = 0 To UBound(p)
        b(lngLoop) = CLng("&h" & p(lngLoop))
    Next
    Debug.Print StrConv(b, vbUnicode)
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SolveEtCoagula07Author Commented:
[RESOLVED - Thank you for your help] I had to modify some things (probably because I'm working with Microsoft Visual Studio Community 2015) and get it working up to the point of the address "Debug.Print strWantThis".  Line 19 however gives me errors about 'b' (cannot change b from byte() to string) and vbUnicode doesn't exist.
aikimarkCommented:
Ah.  This question was in the VB Classic zone, so I posted VB code that was compliant with a VB6/VBA compiler.
SolveEtCoagula07Author Commented:
Yeah...I don't really know what makes them different or how to tell which is which.
aikimarkCommented:
Base your zoning decision on the development environment. If you use Visual Studio, then it is VB.Net.  If you use Office or VB3-6, it is VB classic.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.