Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Interpreting USB data

Solved!
Go to solution

Hi,

 

I have connected a GPS device to the USB port and attempting to read the byte code that the device sends out periodically. Problem is that when I read the data using the USB read function, I am getting all kind of gibberish data in the string output. I am using "Advanced Serial Write and Read.vi" from the examples of the USB read function.

 

If I use RealTerm software it shows me the correct data stream.

Example:

Data read from program is like:«ß/Bo8Á†[f«

Data read in real term is like:10 8F AB 00 00 E2  A4 04 etc.. the two lines of information dont correspond to each other, i just gave them as an example.

 

How do I go about interpreting/converting the read data to the second format?

 

Thanks & Regards,

Sandeep

0 Kudos
Message 1 of 7
(4,809 Views)
Solution
Accepted by topic author sandeepchinni

Your first section does not make any sense. There is no such thing as Advanced Serial Write and Read from USB examples. The USB and Serial examples are as different as night and day. DO NOT CONFUSE USB WITH RS232/SERIAL!

 

Your second problem is just a matter of setting the string indicator to hex display. Right click on the indicator to change the display format.

Message 2 of 7
(4,807 Views)

My mistake, I mixed up USB and VISA. I was referring to VISA read function.

 

How simple a solution, and I did all sorts of things on the output to get the correct format!

 

I bow to you knight of NI!!

 

Thanks a lot,

Sandeep

0 Kudos
Message 3 of 7
(4,798 Views)

I am able to get the display in the correct format, but if I get the output from VISA read directly for processing the string, it is still in the gibberish format! 😞 discovered that late!

 

What function can I use to convert it to hexadecimal format? Say if I want to compare it with a hexadecimal string or number?

 

Sandeep

0 Kudos
Message 4 of 7
(4,773 Views)
What mode have you got the GPS device set to use? the gibberish you refer to could easily be SiRF data output, you would be better altering the GPS to NMEA mode which is considerably easier to read/ parse - Mike
0 Kudos
Message 5 of 7
(4,521 Views)

The data whatever you use is always in Hexa decimal format only. All hexdecimal, Ascii text, octal, binary are just representations. If you need to process them as single byte, convert them to  byte array (if you have many bytes to process)

0 Kudos
Message 6 of 7
(3,571 Views)

Can you share the VI that you created for reading USB?
I am just starting to learn about USB communication in Labview. 

0 Kudos
Message 7 of 7
(3,569 Views)