LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help sending multiline interface commands

Solved!
Go to solution

Hello,

 

I have an instrument that is controlled by its own software on a PC that it is connected to with GPIB and RS232. I would like to write a labview program that emulates what the software does. I ran the GPIB analyzer during the initialization of the machine and captured this:

Capture3.PNG

 

I want to send these 6 commands in LabView so I have a little vi that initializes the machine. I looked at this thread and tried to follow the advice given there. I need to send the string @?#yI followed by a line feed. I'm very new to LabView so I downloaded the example GPIB read/write and tried to make the changes suggested. Here is a screenshot of my attempt:

Capture.PNG

 

 

I'm sure this has many mistakes, can someone point them out to me? When I run it it either a) does nothing or b) gives me an error saying "the interface associated with this session is not the controller in charge".

 

Also, how can I send the "line feed" character? The manual for the instrument (attached, check page 63) says statements must be followed by a PRINT statement which is the line feed character according to the GPIB analyzer output ("a" in the sixth line).

 

Thanks!!!

 

 

0 Kudos
Message 1 of 12
(5,660 Views)
Your resource name makes no sense. The VISA function you are using makes no sense. Put a VISA Write on the block diagram. On the resource name input, right click and select 'Create Control'. Do the same for write buffer. On the front panel, click the pull-down of the resource name control. You should have s list of names to select from such as GPIB0::n::INSTR where n is the address of your instrument. Right click the write during control and select '\´ Codes Display. Use \r for a carriage return and \n for a line feed.
Message 2 of 12
(5,647 Views)

Thanks for the advice Dennis. This is what I ended up with:

initiuialixewr.PNG

The VISA read sends the 4 green commands (TA0, UNL, LA3, SC25) by itself and the "I\n" in the buffer sends the data.

 

Now I am trying to get information back from the instrument. This screenshot is what the software is doing (and I want to replicate). In the red square are the commands I want VISA read to send. The instrument sends "60." back. 

ideal.PNG

 

Basically, I want to have listener address 0 (LA0), talker address 3 (TA3) and secondary address 13. 

 

Here's what I tried:

try.PNG

You can ignore the stuff at the begining and see that for the VISA read I set the VISA resource name as GPIB::0::13::INSTR. However that created this result:

013.PNG

There is a big mess of green commands. I need LA0 and TA3. In this case I got LA0 but TA0 instead of TA3. This was the error I got when I ran it:

013error.PNG

 

So then I tried using the same block diagram but with the address GPIB::0::13::INSTR for the VISA resource name input on the VISA read. This time this is what happened:

313error.PNG

 

This time I got LA3 not LA0 and the TA was not set at all. This was the error when I ran it:

313error.PNG

 

Do you have any ideas on how to get this to work properly and what I am doing wrong? 

 

Thanks!

 

0 Kudos
Message 3 of 12
(5,569 Views)
Reading from address 0 means you are reading from the GPIB controller. You want the same address as the instrument - 8.
0 Kudos
Message 4 of 12
(5,548 Views)

Sorry, it look like there's a typo in my post and I can't edit it. The first set of pictures is my attempt using GPIB::0::13::INSTR. The second is my attempt using GPIB::3::13::INSTR.

 

I now understand why I cannot read from address 0, but shouldn't it work if I read from address 3 (which is the instrument)? The 8 isn't for the address of the instrument, it actually specifies which function to use. Here's a screenshot from the manual:

sec.PNG

So if you look at the case statement in the block diagram and the VISA write I send "DI" to secondary address 8 which means DC method and constant current.

 

Now I am trying to read from secondary address 13 and primary address 3.

 

As a side note, secondary address 13 is not listed in the manual... probably just poor documentation (manual is attached to my original post).

 

0 Kudos
Message 5 of 12
(5,526 Views)
Sorry, my 8 was a typo.

When you are sending the \n, is your string constant set for \ Codes Display? It's a right click option.
0 Kudos
Message 6 of 12
(5,508 Views)

Yep, the \ codes option is selected. The \n goes through fine and I can successfully do the VISA write, sending the data I want. Once I send it the system is supposed to send some data back and I can't get the VISA read to work to let me see that data. For example in the screenshot I posted the data sent back is the "60." under the red box. 

0 Kudos
Message 7 of 12
(5,493 Views)
MAX comes with a gpib communicator besides VISA. Have you tried that? I don't have any other ideas.
0 Kudos
Message 8 of 12
(5,480 Views)

Is that something I could use in LabView?

0 Kudos
Message 9 of 12
(5,444 Views)
Solution
Accepted by topic author imperial07
After testing communication with the utility, you can use the lower level GPIB functions in LabVIEW instead of VISA. For such an old instrument and one that is not IEEE-488.2 compliant, that might be an appropriate way to go.
Message 10 of 12
(5,437 Views)