Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

32 bit integers transported over gpib

Solved!
Go to solution

Hello,

 

I am currently writing a controlling and data aquisition software for an Instron testing machine with a GPIB Bus with Labview. The machine isn't the youngest, so I can only use the 488 commands, not the VISA commands. My controlling software works this far, but with the data aquisition I encountered some problems for which I couldn't find a solution this far. I just taught Labview to myself two months ago, so sorry if my questions seem silly to you. I searched the forum and the internet and couldn't find an answer to them.

 

So here's my problem:

I am Reading out data from my Machine with the command "GPIB-Read", it gives out a string, so I gues it automatically assumes that the data is encoded in ASCII. The machine though uses its own coding, described in its manual! I can read the header of the measurement (it is "#I" in ASCII), after that there is a 32-Bit signed Integer representing the length of my data block. Then there is a 16-Bit Byte and after that many 32-bit signed Bytes that represent my measuring data. There are no seperation marks.

When I read it out, I just get a string of crazy ASCII code (besides the "#I" at the beginning)

 

My approach to decoding the message this far is this:

I convert the ASCII code to binary code (not with Labview yet, I couldn't find out how it works either. is there an easy way to do this?) , then I ignore the first 64 Bits (2x8Bits of the header+ 32 Bit Integer+16 Bit Integer) and then I try to split up the string in an array of 32 Byte  long strings and see if the data is right. In my measurement, i had three values which where constant, so it should just be three alternating values. I always get wrong data and I am mostly not working with Labview, but I have to later on, because I want to display the data in real time.

 

It's a lot of work and I just wanted to know, if I'm on the right track or if there is an easier solution. Later on, it shouldn't be a problem to display an integer array as a wave, right? Are there any hints or advice you can give to me?

 

Sincerely,

Simon

 

0 Kudos
Message 1 of 4
(3,804 Views)
Solution
Accepted by topic author karl_ender
  1. VISA calls 488.  So I don't see why you can't use the VISA functions.
  2. A Byte is 8 bits.  So there is no such thing as a 16-bit byte.  That is a word.
  3. Unflatten From String is your friend here.  You can use it to decode each part of your command.  And since your actual data is just a string of 32-bit words, you can use the Unflatten From String to turn that into an array directly, just make sure the "Data includes array size" is set to false.

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(3,792 Views)

Thanks a lot for your quick answer! I'll try it out as soon as I get back to the university. Your right, I accidently wrote 32-bit Byte instead of 32-bit Integer on accident a couple of times.

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

I just tried it out and everything worked out perfect 🙂 I've been sitting on this for a while now, but with your help I could programm the whole data aquisition in a couple hours this morning. Thanks again!!

 

Simon

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