Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

When controlling a device via GPIB, upon program exit and LabVIEW exit the device returns to local mode however the PON REM switch is high. How can I avoid this?

Forgive me if this answer is somewhere on the message boards or knowledge base, I searched but couldn't find anything similar.

I am trying to control a Xantrex XFR 35-35 power supply via GPIB using LabVIEW 8.2. I am using the LabVIEW supplied example called 'LabVIEW<->GPIB.vi' found in the smplgpib.llb library. When controlling the device using this example, the device responds appropriately, however upon LabVIEW exit, long after the VI has completed and been closed, under certain conditions the power supply exits remote mode (it's PON REM swicth is high so it always starts up in remote mode). Remote mode indicates the device is being controlled by another means than it's front panel controls, while local mode means that it is controlled via the front panel. I want to make sure that upon exit it does not do this because I need the device to remain in remote mode at all times. I have seen suspicious behaviour that makes me think the power supply is put into local mode when LabVIEW exits based on the power supply's current state and how the last string was written to it from this LabVIEW VI -- when in fact it should only exit remote mode if I send it a command to do so (Go To Local command).

Power supply (P/S) info: The command to set voltage and current on the P/S is VSET <value> and ISET <value> respectively. The command to query current voltage and current on the P/S is VSET? and ISET? respectively.

Results of four tests:

Test 1
-'Operation' control set to 'Write to Instr', 'GPIB Write' VI mode input set to default (0), 'Characters to Write' control input is 'VSET 25 ISET 5'.
- P/S responds to command and changes accordingly. VI finishes running.
- Close VI. P/S still in remote mode.
- Exit LabVIEW, P/S changes from remote to local mode.
- Re-open LabVIEW and VI.
-'Operation' control set to 'Write then Read', 'GPIB Write' VI mode input set to default (0), 'Characters to Write' control input is 'VSET?'.
- P/S responds to command and returns VSET 25.000 in 'Characters Read' indicator. VI finishes running.

Test 2
-'Operation' control set to 'Write to Instr', 'GPIB Write' VI mode input set to 'Do Not Send EOI' (7), 'Characters to Write' control input is 'VSET 25 ISET 5'.
- P/S responds to command and changes accordingly. VI finishes running.
- Close VI. P/S still in remote mode.
- Exit LabVIEW, P/S still in remote mode.
- Re-open LabVIEW and VI.
-'Operation' control set to 'Write then Read', 'GPIB Write' VI mode input set to 'Do Not Send EOI (7), 'Characters to Write' control input is 'VSET?'.
- P/S doesn't respond to numerous attempts at writing and reading the respond. 'Characters Read' indicator is blank. This is expected behaviour because the EOI was not sent on both writes (VSET 25.000 and VSET?) so the power supply is still in listen mode and not talk mode, in order to supply the voltage query.

Test 3
-'Operation' control set to 'Write then Read', 'GPIB Write' VI mode input set to default (0), 'Characters to Write' control input is 'VSET 25 ISET 5'.
- P/S responds to command and changes accordingly. VI finishes running.
- Close VI. P/S still in remote mode.
- Exit LabVIEW, P/S still in remote mode.
- Re-open LabVIEW and VI.
-'Operation' control set to 'Write then Read', 'GPIB Write' VI mode input set to default (0), 'Characters to Write' control input is 'VSET?'.
- P/S responds to command and returns VSET 25.000 in 'Characters Read' indicator. VI finishes running.

Test 4
-'Operation' control set to 'Write then Read', 'GPIB Write' VI mode input set to 'Do Not Send EOI' (7), 'Characters to Write' control input is 'VSET 25 ISET 5'.
- P/S responds to command and changes accordingly. VI finishes running.
- Close VI. P/S still in remote mode.
- Exit LabVIEW, P/S still in remote mode.
- Re-open LabVIEW and VI.
-'Operation' control set to 'Write then Read', 'GPIB Write' VI mode input set to 'Do Not Send EOI (7), 'Characters to Write' control input is 'VSET?'.
- P/S doesn't respond to numerous attempts at writing and reading the respond. 'Characters Read' indicator is blank. This is expected behaviour because the EOI was not sent on both writes (VSET 25.000 and VSET?) so the power supply is still in listen mode and not talk mode, in order to supply the voltage query.

Obviously I cannot use the two 'GPIB Write mode' = 7 scenarios because I cannot read the value afterwards, but the other main observation (go to local mode when no read is permorfed) raises the main question I have: why is the REN line that controls remote/control mode negated upon LabVIEW exit only when a 'GPIB Write' is used in default mode, and not after a 'GPIB Read' in either string termination mode. I would tend to blame this on myself for not following the power supply communication protocol (initialization first, etc.) or the power supply for improperly responding to a command, BUT I did not request for the GPIB device to exit remote mode, and this problem seems to stem from a handle that LabVIEW still has on the library that controls the REN line of the GPIB device, since the problem occurs on application exit and not VI exit.

Any help would be much appreciated, thanks.
William
0 Kudos
Message 1 of 6
(4,315 Views)
Spelling error: fourth last line should read "remote/local", not "remote/control".
0 Kudos
Message 2 of 6
(4,308 Views)
What visa/gpib version are you using?
check MAX software to find the software version numbers.

This instrument should stay in local mode but maybe one of the settings in MAX can take care of this.
greetings from the Netherlands
0 Kudos
Message 3 of 6
(4,289 Views)
The VISA s/w version is 4.0. The NI-488.2 s/w version is 2.46.

I want the instrument to stay in remote mode after exiting labVIEW, and I suspect it could be something to do with the GPIB termination mode settings in MAX. The settings are in the two attached pictures. I also have this log from NI Spy. Steps 1,2,3 are writing and reading from the GPIB and quitting LabVIEW (it statys in remote mode), steps 6,7,8 query for the voltage setting and quit LabVIEW, steps 9,10 simply write the new voltage setting and quit LabVIEW (this takes it out of remote mode to local mode, somthing I want to avoid), and steps 11,12,13 query for the new voltage setting and quite LabVIEW. I can't see anything different between the "write then read" voltage setting and simple "only write" voltage setting, unless the "Read" in between writing the new voltage and exiting LabVIEW does something to the controller to make it stay in remote mode.

1.  GPIB Write (2, "vset 30.iset 5", 0, 5000, 256)
Process ID: 0x00000988         Thread ID: 0x00000684
Start Time: 10:08:35.359       Call Duration 00:00:00.266
Status: 0 (VI_SUCCESS)
2.  GPIB Read (2, 200, 0, 5000, ".", 8448)
Process ID: 0x00000988         Thread ID: 0x00000684
Start Time: 10:08:35.828       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
3.  ibonl(UD0, 0)
Process ID: 0x00000988         Thread ID: 0x000009BC
Start Time: 10:08:49.328       Call Duration 00:00:00.000
ibsta: 0x100       iberr: 0             ibcntl: 0(0x0)
4.  GPIB Write (2, "vset?", 0, 5000, 256)
Process ID: 0x00000BEC         Thread ID: 0x00000D20
Start Time: 10:27:02.125       Call Duration 00:00:00.046
Status: 0 (VI_SUCCESS)
5.  GPIB Read (2, 200, 0, 5000, "VSET 30.000  ..", 8448)
Process ID: 0x00000BEC         Thread ID: 0x00000514
Start Time: 10:27:02.375       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
6.  ibonl(UD0, 0)
Process ID: 0x00000BEC         Thread ID: 0x0000061C
Start Time: 10:27:15.078       Call Duration 00:00:00.000
ibsta: 0x100       iberr: 0             ibcntl: 0(0x0)
7.  GPIB Write (2, "vset 30.iset 5", 0, 5000, 256)
Process ID: 0x00000C34         Thread ID: 0x00000944
Start Time: 10:29:28.250       Call Duration 00:00:00.265
Status: 0 (VI_SUCCESS)
8.  ibonl(UD0, 0)
Process ID: 0x00000C34         Thread ID: 0x00000A9C
Start Time: 10:29:36.218       Call Duration 00:00:00.000
ibsta: 0x100       iberr: 0             ibcntl: 0(0x0)
9.  GPIB Write (2, "vset?", 0, 5000, 256)
Process ID: 0x00000DC8         Thread ID: 0x00000DEC
Start Time: 10:30:15.859       Call Duration 00:00:00.031
Status: 0 (VI_SUCCESS)
10.  GPIB Read (2, 200, 0, 5000, "VSET 30.000  ..", 8448)
Process ID: 0x00000DC8         Thread ID: 0x00000DEC
Start Time: 10:30:16.093       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
11.  ibonl(UD0, 0)
Process ID: 0x00000DC8         Thread ID: 0x00000E28
Start Time: 10:30:35.828       Call Duration 00:00:00.000
ibsta: 0x100       iberr: 0             ibcntl: 0(0x0)

The only other thing I can think of is that the communication protocol between the specific power supply and LAbVIEW isn't being followed properly.
Download All
0 Kudos
Message 4 of 6
(4,259 Views)
Hey William,
Try to run NI-Spy, and then the program where your power supply goes to Local Mode, it will exactly tell you what commands are being transmitted at when labVIEW exits and then you can compare it with the program where it is still remaining in the Remote Mode.
Look at this Knowledge Base which explains how you can capture using NI-Spy.
Thanks and good luck with everything,
Regards
Nikhil A.
0 Kudos
Message 5 of 6
(4,219 Views)

Hi willforbriger,

From what I have seen along these lines, the expected behavior when LabVIEW is closed is for the GPIB handles to be dropped and REN line goes low (causing your machine to go into local mode).  The only exception that I have seen is when you leave a session open before closing your application.  Another work-around I saw discussed in another forum post, would be to physically tie the REN line of the bus to ground so that the device is always in Remote Control.  If you never want to have the power supply controlled from it's own front panel, this may be your best option.  Hope this helps!


Regards,
Anna M.
National Instruments
0 Kudos
Message 6 of 6
(4,214 Views)