Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get binary floating point over GPIB?

Hi,

I am trying to read binary floating point numbers from a SR850 lock-in using GPIB. The GPIBWrite function only gives the output as a string. There is no way to access type-cast nodes of any kind. I don't know how it converts the data to a string, so I don't know how to unflatten it (if that is what is required).

Please let me know how to get the binary floating point data out. My only other option would be to get the data out one point at a time or try to decode the string somehow, which would be very time-consuming.

Thank you,
Beverly
0 Kudos
Message 1 of 6
(4,811 Views)
What language are your using? You mention "type-cast nodes" which makes me think you are using LabVIEW. If so, why don't you have access to the typecast function?

Here is a tutorial on the web on how floating point numbers are represented in binary format:
http://www.compapp.dcu.ie/~ray/NewCA103/DataRepresentation.pdf

Ray K
NI Applications Engineer
0 Kudos
Message 2 of 6
(4,811 Views)
Thank you very much for your response. I really need help on this!

Yes, I am using LabVIEW. The GPIBRead function on LabVIEW only has a string output for the data. I assume it took each byte of the 4 byte floating point number and converted it to a character. How do I convert the string back into a floating point number?

I am trying to do a binary transfer. I can't find any instructions in the LabVIEW manual for this. I mentioned the typecast function because I noticed a similar question posted, and the reply was to examine the typecast. The problem is that there is no way to access the diagram of the GPIBRead VI to see what is going on.

I know there must be a way to do this in LabVIEW. The SR850 manual states the the transfer is binary floating po
int (4 bytes per number) that can be read directly into a floating point array.

Beverly
0 Kudos
Message 3 of 6
(4,811 Views)
Beverly,

The GPIB Read VI will return the data as a string. You must then take the resultant string and use the typecast operator (which is in one of the palettes) to "reinterpret" the data as if it were a floating point array. To do this, wire a floating point array to the top of the typecast and the input string (output from the GPIB Read) to the left of the typecast and the resultant array will appear on the right-side of the typecast.
0 Kudos
Message 4 of 6
(4,811 Views)
I am sorry this is not an answer. But, I am also using a SR lock-in and have the same problem. I wire the type cast icon correctly, but am unable to read out the correct data. Has anyone been succesful doing this?

Thanks!
0 Kudos
Message 5 of 6
(4,811 Views)
Ok, I figured it out ... as you must have as well 🙂

The lock-in representation of IEEE float differs slightly from Labview's representation. Basically, one has MSB first, LSB last while the other wants the opposite. Just swap at the byte level, and all is good.
0 Kudos
Message 6 of 6
(4,811 Views)