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.
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?
Thanks for your response.
Here is some example serial data coming from the IMU:
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.
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.