LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send a command and read the status bit in string form?

Hi, I would like to ask how can I send a command to my instrument and read the status bit in string form? I have tried the following VI but it does not work. May I know if I'm doing it right?IMG_5588.jpg

0 Kudos
Message 1 of 8
(2,205 Views)

Hi hs,

 


@hs1234 wrote:

I have tried the following VI but it does not work. May I know if I'm doing it right?


Answer: when "it does not work", then you are doing it wrong! 😄

 

There is no VI attached to your message, but only a huge image showing a smaller part of a block diagram with hidden wires.

Is there a reason to use those old GPIB functions? Which hardware do you use and which LabVIEW version?

 


@hs1234 wrote:

how can I send a command to my instrument and read the status bit in string form?


The answers to those questions is found in the manual of your device! Did you read it?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(2,200 Views)

It doesn't look like you are using those functions correctly.  First, since your string doesn't look terminated, you probably need to either include the termination in your string, or set the mode parameter of the SEND function, or the instrument may never respond (that depends on the instrument, of course).  Second, even if you string does get sent, you are trying to receive a response immediately after; the RECEIVE function reads what is currently on the bus, but your instrument likely hasn't even had time to respond, so you will get nothing.

 

Use VISA functions. Or at least GPIB Write and GPIB Read, so you can set some timeout values

 

Edit: GerdW, I think that thick pink line is an Error line. This looks like a pretty old version of LabVIEW

0 Kudos
Message 3 of 8
(2,174 Views)

Hi mancho,

 


@Mancho00 wrote:

Edit: GerdW, I think that thick pink line is an Error line. This looks like a pretty old version of LabVIEW


I know. I guess it's LabVIEW 6 or 7...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(2,144 Views)

Hi all,

 

I apologise for only showing a part of my VI. The reason why I'm doing so is because this instrument that I'm working on belongs to my workplace, and the PC that I'm using as the controller does not have access to internet. And yes, this is a pretty old version of labview.

 

I have tried the method mentioned by Mancho00, by replacing the Send and Receive functions to GPIB Write and GPIB Read functions, but to no avail. 

 

I have also tried setting the mode parameter for the Send function to 2 (Send EOI with the last data byte in the string), which is evident in the following images.

 

The following images are some of the sequences in my VI, where:

- the first sequence is to set the device-status enable register to FFH;

- the second sequence is to read the device-status register, and start the test when the status bit returns 1;

- the third sequence is to read the device-status register at the end of the test to determine if its a pass/fail.

 

May I know if why does this not work? Does the problem lies in the command? Or does it lies in the way I wired my functions?

Download All
0 Kudos
Message 5 of 8
(2,127 Views)

Hi hs,

 


@hs1234 wrote:

May I know if why does this not work? Does the problem lies in the command? Or does it lies in the way I wired my functions?


Unfortunately you forgot to answer my questions on your hardware!

 

When I was working with those old GPIB functions I never needed to use the Send/Receive combination, but sticked with Read/Write successfully...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(2,119 Views)

Hi GerdW,

 

I apologise, but I'm not quite sure what hardware are you referring to because I'm new to this. Could you please explain?

 

Also, may I know how you did it with just Read/Write functions? Because I did try using Read/Write functions by replacing my Send/Receive functions with Read/Write functions (with timeout included on the Receive function), but my instrument did not respond. So I'm not sure what could have went wrong, whether its my command or the way I used my functions in the block diagram.

0 Kudos
Message 7 of 8
(2,111 Views)

@hs1234 wrote:

Hi GerdW,

 

I apologise, but I'm not quite sure what hardware are you referring to because I'm new to this. Could you please explain?


You are trying to use the GPIB IEEE488.2 functions. These only work with GPIB instruments. They require also a GPIB controller of some sorts in your computer that is connected with a BIG connector to your instrument, which must also have such a BIG connector, and if your GPIB controller is a built in card in your PC you also need a heavy and very rigid cable with one such big connector on each end.

 

204693312.jpg

 

If the instrument (the hardware Gerd is referring to) is not a GPIB instrument, you are definitely barking up the wrong tree in trying to use the functions you show. And even if it is a GPIB instrument and you have a GPIB controller then the recommended way to talk to your instrument since about two decades is to use the VISA functions instead.

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 8
(2,105 Views)