From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading IMU via RS-485 Output Missing Packets, Accel Data Incorrect

Hello Everyone,

 

I've been working on a serial interface for reading the output of an Inertial Measurement Unit (IMU). I began with the RS-485 example from NI and have been building since then. The IMU message packet I am trying to record is 18 bytes, takes 1.7ms to deliver, and starts with 2A (hex). I am using the string match to find the proper byte for the beginning of the message, so I have to look at more than 18 bytes in case 2A is not the first byte I see (I think). Then I do some conversions and save to a text file. If I had to guess the Visa byte count is messing me up.

 

Any ideas out there? Thanks a lot everybody.

 

-Troy  

 

 

0 Kudos
Message 1 of 4
(3,150 Views)

Why is your offset starting at 2? 

 

Could you post an example visa read that would need to be parsed? I also wonder about some of operation you are doing in the for loop, what are they for? 

 

splitstring.png

Jesse Dennis
Engineer
INTP
0 Kudos
Message 2 of 4
(3,137 Views)

Hi Jesse,

 

Thanks for your response.

 

Here is some example serial data coming from the IMU:
\00*\1F\FE\FF\F6\FF\E1\FF\F7\02\18\00\86\FD\1E\b\00-*\s\DD\FF\19\00\07\00\F8\02#\00\81\FD\s\b\FC\FB\00*!\F5\FF\12\00\F2\FF\EA\02\19\00\82\FD\1F\b\00\15*"\00\F8\FF\t\00\F1\FF\F3\02'\00\02\CD\FD\1B\b\00\FB\00*3\DA\FF\t\00\r\00\FB\02"\00\90\FD*\b\00\E6*$\FB\FF\EF\FF\E4\FF\02\03\1E\00\8A\FD\11\b\00$*%\F8\FF\D9\FF\n

 

The For Loop converts all the ascii to hex and takes out the slashes.

 

So, 00* becomes 002A and thats the start of the message packet (though I'm just looking for 2A). Message packet is 18 bytes long.

 

Ideally, I'd see that 2A, then begin writing the message packets to file. I believe a loop would work best, but I do not have a lot of experince with Labview and don't quite know how to do it.

 

Your assistance is much appreciated.   

0 Kudos
Message 3 of 4
(3,131 Views)

Hi Troy

 

You're biggest problem is you are not lazy enough.

That for loop is removing slashes that are only on the display. In the wire the pure binary representation is available so you can start immediately with searching for the correct pattern.

A common misunderstanding is that messages are sent in hex but almost always messages are in binary and on the screen represented in hex.

 

So take a look at your data after converting it to an array and see what is present.

 

good luck

greetings from the Netherlands
Message 4 of 4
(3,127 Views)