473,394 Members | 1,841 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,394 software developers and data experts.

How to recognize the data format from GPS-M1zz?

Dear VB mania, especially VB6 specialist

I have a problem with my GPS. So far, I have a GPS-M1zz from Pioneer Navicom company. It has 2 type of data format, i.e. Pioneer Format and NMEA data standard. I have already retrieved and parsed the NMEA one using VB6 properly. I could display all NMEA data concisely. I could understand weell this standard.
But, now, I have a problem with the Pioneer format standard. It is very different format with special HEX data format rather than NMEA with ASCII character.
I`ve already tested a small routine program to retrieve Pioneer data format. Below is the example:
case I : I used the function:
varBuffer = mscPort.Input
txtRecieveData.Text = txtRecieveData.Text & varBuffer:
output:
u€  イC &О& ( ! 64・ u€  イC &О& ( ! 64・ u€  イC &О& ( ! 64・ u€  イC &О& ( ! 64€

Case II:
But, when I wrote
varBuffer = Asc(mscPort.Input), the output becomes:
16178161783016178301617830161783016178301617830161 78301617830161783016178301617830161783016178301617 83016178301617830161783016178301617830161783

In order to understand the Pioneer packet format, here they are:

<DLE> <ID> <data type> <CS> <DLE> <ETX>
in case of checksum byte is exist.
DLE(Data Link Escape) is 2 byte with HEX number 10h
ID = 1 byte
ETX (End of Text) with HEX number 03h

The questions are:

1. How to recognize the beginning of Data, ID etc, when I use CASE II retrieved data? Is there a mistake with my routine? If yes, how to revise it?

2. This format is no delimiter like NMEA format with "comma". It is sequently the data is retrieved. How to parse it into each of their sentence part?

I need helps.

Thanks alot.

ps: I am using VB6 version.

Regards,
basyarie
Feb 28 '07 #1
7 3281
Killer42
8,435 Expert 8TB
Could you try displaying all the ASCII values from Case I, in hex format? Something simple would do, like this (not tested, and assuming your u€  イC &О& ( ! 64 data is in a variable called strBuffer)...
Expand|Select|Wrap|Line Numbers
  1. Dim I As Long
  2. For I = 1 To Len(strBuffer)
  3.   Debug.Print Hex$(Asc(Mid$(strBuffer,I,1)))
  4. Next
Mar 1 '07 #2
Thanks Mr.Moderator,

I`ve tried your code in Debug window and the result is like in below:
10 DLE
75 ID
80
1
F4E7
D
7
B2
2E
72
19
8145
1E
FF
FF
7
3
2
10
10
39
18
7
3
2
9
24
27
FF
7F
FF
7F
FF
FF
1A
10 DLE
3 ETX

Here, DLE is start of packet, and ETX is last of packet. In my GPS case, there are many packet ID, in this case, ID75 is confirmed. But, so far I don`t understand well this packet type, because the manual book is in Japanese. :)
Okay, your code could change the data to Hex format. But, when I tried to display in VB Text window, gradually "Not Responding" state is clarified.
My code is:
txtReceiveData.Text = txtReceiveData.Text & Hex$(Asc(Mid$(varBuffer, i, 1)))

Why it appeared?

Thanks a lot.
Mar 2 '07 #3
Killer42
8,435 Expert 8TB
:) It sounds as though you're closer to your goal, at least.

...But, when I tried to display in VB Text window, gradually "Not Responding" state is clarified.
Not sure what's happening here. I think we'd need to see more of the code. That one statement looked alright, as far as I can tell.
Mar 2 '07 #4
Dear Moderator,

Thank you very much for the response.
It`s a great for me could discuss my problem here.
Actually, my goal is how to retrieve the Gyro data from my GPS unit and then parse it aimed at controlling an electronic circuit. But, now, I need the Gyro data from my GPS (because it includes Gyro sensor). And it should be done by retrieving the manufacturer defined data packet. In this case, HEX number data packet. I got, but mistake type of data.
Okay, now, I`d like to explain the circumstance.
So far, I had an answer from my GPS manufacturer. They told me that I should retrieve "IDA3 type data". To get it, an input HEX number data should be sent. The format is (in HEX), each of part is 1 byte of the lenght (the whole are 6 bytes):

10 A3 00, 01, or 02 CS 10 03

<DLE> <ID> <Data for checksum> <Checksum> <DLE> <ETX>

And the output should be (in HEX):

<DLE> <ID> <ST> <Speed> <Direction> <Odometer> <Speed check value> <Direction check value> <CS> <DLE> <ETX>

DLE, ID, ST, ETX is 1 byte
Speed: 2 bytes
Direction: 2 bytes
Odometer: 4 bytes
each of check value: 2 bytes

My routines programs is below:
1. <send data command button>
Expand|Select|Wrap|Line Numbers
  1. '   Event to load button "Send"
  2. Private Sub cmdSendData_Click()
  3.  
  4. Dim Dat As String
  5. Dim L As Long
  6. Dim A As Variant
  7. Dim CC As Variant
  8. Dim CS As Variant
  9. Dim DatTX As Variant
  10. Dim i As Long
  11.  
  12.  
  13.     '   Confirmation of Comm port is opened or not
  14.     If mscPort.PortOpen = True Then
  15.  
  16.         '   Written words on the textboxt is sent
  17.         '   then at the terminator they are added
  18.         mscPort.Output = txtSendData.Text & Chr(&HA)
  19.  
  20.         Dat = txtSendData.Text
  21.         L = Len(Dat)
  22.         A = 0
  23.         For i = 1 To L
  24.             CC = Mid$(Dat, i, 1)
  25.             A = Asc(CC) Xor A
  26.         Next i
  27.  
  28.         CS = Hex$(A)
  29.  
  30.         If Len(CS) = 1 Then
  31.             CS = "0" + CS
  32.         End If
  33.  
  34.         DatTX = "10" + "A3" + Dat + CS + "10" + "03" + Chr$(13)      
  35.         'gyro input format
  36.         mscPort.Output = DatTX           
  37.        ' TX data buffer
  38.  
  39.         Debug.Print DatTX
  40.      End If
  41.  
  42.         For i = 1 To Len(DatTX)
  43.  
  44.         Next
  45.  
  46. End Sub 
2. <OnComm subroutine>
Expand|Select|Wrap|Line Numbers
  1. Dim varBuffer As Variant
  2. Dim varBuffer2 As Variant
  3.  
  4. Select Case mscPort.CommEvent
  5.      Case comEvReceive
  6.      Dim i As Long
  7.      For i = 1 To Len(varBuffer)
  8.         varBuffer2 = Hex$(Asc(Mid$(varBuffer, i, 1)))
  9.         txtReceiveData.Text = txtReceiveData.Text & varBuffer2
  10.      Next
  11. End Select
  12. End Sub 
With this code, I still do not get the Gyro data sentence. Is there any mistake with my code?

Okay, That`s all.

I need helps.
Thanks a lot.



Moderator wrote:
>>It sounds as though yopu're closer to your goal, at least.

>>Not sure what's happening here. I think we'd need to see more of the code. That >>one statement looked alright, as far as I can tell.
Mar 6 '07 #5
Killer42
8,435 Expert 8TB
I'm out of my depth here. For one thing, I've never done anything much with the comm control.

I do have a couple of questions, though:
  • Are you sure that the command (the 10 A3 01...) is supposed to be sent as a hex representation? This seems a little surprising to me, but of course that doesn't make it wrong.
    If we take this example: 10 A3 00 - this can be a representation of 3, 6 or 8 bytes, depending on how you interpret it. That makes this kind of discussion very confusing at times. But your description seems to indicate that this represents three bytes, while your code sends it as 6 (ASCII character "1", then "0", then "A", then "3" and so on).
  • Is the text supposed to be sent twice? That definitely doesn't seem correct.
    mscPort.Output = txtSendData.Text & Chr(&HA)
    mscPort.Output = DatTX
  • In the OnComm routine, where did varBuffer get its value? I don't see any code to set it - is it a parameter to the event procedure?
Mar 6 '07 #6
Dear Moderator,

Thank you very much for the response.
Two days ago, I have finished my work completely even though only one bug is exist. But, all of my routines program could be performed properly.

Thanks a lot.

Next time may I will discuss here again.

See..

basyarie
Mar 13 '07 #7
Killer42
8,435 Expert 8TB
Glad to hear it worked out.
Mar 13 '07 #8

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

Similar topics

11
by: Dale | last post by:
How to recognize whether file has XML format or not? Here is the code segment: XmlDocument* pDomDocument = new XmlDocument(); try { pDomDocument->Load(strFileName ) ; } catch(Exception* e) {
1
by: Khan | last post by:
Hi i am doing gps programming but dont know how to start is there any builtin facility avaialable in c sharp or i have to use third party libraries. i need a sample code which can lead me to start...
0
by: Jokes | last post by:
Hello, I want to write a program to read GPS data from PCMCIA GPS receiver on pocket PC, and then send these data to notebook through USB line, using C#. I have already found a GPS data process...
0
by: James Buffington | last post by:
For some reason, my laptop has quit recognizing the GPS receiver. I have reinstalled the software, scanned for the received - everything that is called for, with no results. To insure that the...
2
by: Hugh Janus | last post by:
I am trying to receive GPS data into a pocket PC 5.0. I am using the device emulator. The main PC has a bluetooth dongle connected and is bonded with the bluetooth GPS transmitter to COM8. In...
1
by: cmk1523 | last post by:
I'm doing work with GPS and I have a file thats around 4Mb. It contains GPS information and my job is detect, correct, and output the results to another file which is in the same format. The file...
3
bartonc
by: bartonc | last post by:
I'm working on a project where I have been collecting grade, cross-slope and distance from sensor unit of my own design and exporting the data (from an SQL database) to a proprietary format. Now I...
67
by: James Harris | last post by:
I have a requirement to store timestamps in a database. Simple enough you might think but finding a suitably general format is not easy. The specifics are 1) subsecond resolution - milliseconds...
1
markmcgookin
by: markmcgookin | last post by:
Hi, This is a question re: a mobile development project, however I feel my issue is C# based and not anything to do with the mobile side of thigs, so I will leave this post here (as I feel it'll...
0
by: Independent | last post by:
Python programmers may find the application to decoding an encrypted map image format known as Memory Map to produce a standard PNG image file interesting. Someone obviously very well versed in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.