12-01-2021 04:14 AM
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?
12-01-2021 09:19 AM
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?
12-01-2021 11:12 AM - edited 12-01-2021 11:18 AM
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
12-01-2021 03:59 PM
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...
12-02-2021 12:09 AM
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?
12-02-2021 01:46 AM
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...
12-02-2021 02:47 AM
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.
12-02-2021 03:09 AM
@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.
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.