Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

reading binary data with GPIB read

I am trying to get the settings (binary data)from the HP 3577,therefore I wrote a simple vi but I always get an error when trying to read the binary data in Labview. When I type the same command in MAX (communicate with instrument) I get the data,no prob.
Reading trace data (ascii) seems to be no problem in Labview it is just when the data to be received is binary that I get the problem.
Is there something I can change in the GPIB read vi?
the error message is code:6
0 Kudos
Message 1 of 12
(5,016 Views)
Hi,

There is no difference in reading or sending binary or string data using the GPIB VIs. The driver will transmit each byte's numeric value. Since the GPIB bus is message based and most instruments use ASCII data, the data type used by the GPIB is the string. But this is just the way data is packaged.

Error 6 is a timeout error. For some reason the GPIB interface is not getting the END message (EOI line asserted). Also, check if your instrument uses termination characters.

Do you receive any data at all?. Do you receive half of the data?. Are the two set of data (binary and ASCII)of the same size (number of bytes)?

DiegoF.
National Instruments
0 Kudos
Message 2 of 12
(5,016 Views)
Hi Diego,

I don't receive any data at all, though I takes a pretty long time between entering the get data vi and the time I receive the error.
The manual says nothing about an END message however it says the data is 1400 byte long.
Filling this in the data size doesn't seem to help.

I mentioned the fact that it receives ASCII data just to show that the way I build the program seems to be OK.

But I find it weird that in MAX I get the binary data
in no-time. What is the difference between sending and reading a command in MAX and in Labview?
If it works in Max why shouldn't it work in Labview when the communication is correctly established?

FrederikD
0 Kudos
Message 3 of 12
(5,016 Views)
Hi,

You are right. There shouldn't be any difference.

Could you write down exactly what commands you are using to request binary and ASCII data in both MAX and LabVIEW? You can do a Spy capture from all these cases and attach it to your posting.

Also, What device are you communicating with?
0 Kudos
Message 4 of 12
(5,018 Views)
I am having the same problem. In order to cut down the data coming through the GPIB bus I want to request a 32 bit floating number (single precision float) from my VNA (HP 8573). I can receive ASCII data fine, but I am having trouble converting the binary data into an actual number. I think the GPIB read function is taking the float number and converting it to text...which produces something like this: '#A ?¶³ ?...' the rest won't paste over.


Any ideas on the converstion?


Thanks,

Chris
0 Kudos
Message 5 of 12
(4,926 Views)
It would help if you mentioned which programming environment you're using. There is a LabVIEW Driver and a CVI Driver that you can download. it will do the conversion for you. If you're using LabVIEW and want to do it yourself, it looks like what you need to do is strip off the first 4 bytes and typecast the remainder to a DBL array.

Message Edited by Dennis Knutson on 06-17-2005 10:35 AM

0 Kudos
Message 6 of 12
(4,920 Views)

Dear Chris,

I am having the same problem, I tired many advises, but nothing has worked. Will you advise if you have any solution to that, please.

Thanks

Ben

 

0 Kudos
Message 7 of 12
(1,037 Views)

Ben,

 

This thread is almost 20 year old and may not get a response from those above.  With that said, are you reading the data as a string and displaying that as Normal?  Try displaying in Hex as this will give you the byte data for the unprintable characters.

Minions_0-1698770327311.png

In your code, I would then create the IEEE-754 Single Precision value by:

  1. converting string to an array of U8
  2. Join four of the U8 to create a U32
  3. Extract bit 31 as the sign,
  4. Extract the next 8 bits (30-23) as the exponent
  5. The remaining 23 bits are the mantissa
  6. Follow IEEE-754 to decode.  (After step 2 you can also try to convert the U32 into a single precision float)

See if that helps.

 

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
Message 8 of 12
(1,004 Views)

Follow Minions advice, buat also be more specific in your question and perhaps attach your code.

 

Are you using an HP3577?  LabVIEW driver or VISA Read or GPIB Read as the OP was?

 

What is the expected value and what value do you see?  Are you using the right termination characters, these can differe for some instruments depending on if you are transferring ASCII or BINARY data.

 

Craig

0 Kudos
Message 9 of 12
(958 Views)

Minions,

Hi,

I solved my problem by changing the nature of the data from Binary to ASCII, but the issue is still unresolved for me, I try your advise and I let you know the result.

Many Thanks

Ben

 

0 Kudos
Message 10 of 12
(889 Views)