Thread Subject: GPIB/VISA problem - fopen resets device

Subject: GPIB/VISA problem - fopen resets device

From: chris2k

Date: 27 Jan, 2012 12:00:10

Message: 1 of 5

Hello,

at the moment I'm transferring some measurement functions from an old Pascal program to matlab, using an Agilent 82357B USB to GPIB adapter.
To create a list of GPIB objects, I'm using the following code:
address_dc = 5;
device(1).obj = gpib('agilent',7,address_dc);

If I open the connection to a device using "fopen(device(1).obj)", the device goes to "Remote" mode and back to "Local" when using "fclose(device(1).obj)", as desired.
Unfortunately some devices will be reset when using "fopen(device(1).obj)", like the Anritsu 68187B RF generator or the HP438A power meter.

If I use the "visa" function to create the GPIB objebt, the reset does not occur:
address_dc = 5;
device(1).obj = visa('agilent',['GPIB0::' int2str(address_dc) '::INSTR'])

However now I have the problem, that the device stays ins "Remote" mode if I close the connection using "fclose".

So I have the choice between using "gpib" and causing a reset or using "visa" and the device stays in "Remote"...
Is there a special visa function to send the device back to "Local"? Or do you have a suggestion how to avoid the reset when using gpib?

Thanks!
Christoph

Subject: GPIB/VISA problem - fopen resets device

From: dpb

Date: 27 Jan, 2012 18:45:27

Message: 2 of 5

On 1/27/2012 6:00 AM, chris2k wrote:
...

> So I have the choice between using "gpib" and causing a reset or using
> "visa" and the device stays in "Remote"...
> Is there a special visa function to send the device back to "Local"? Or
> do you have a suggestion how to avoid the reset when using gpib?

I've never had opportunity to try GPIB in conjunction w/ Matlab but I've
done a lot of GPIB (IEEE-488) over the years.

Every GPIB-compliant device should implement the GTL (Go To Local)
command as an addressed (as opposed to broadcast) instruction. However
the Matlab interface allows you to send commands, use that to transmit
the GTL command to the specific device.

--

Subject: GPIB/VISA problem - fopen resets device

From: Vinod Cherian

Date: 27 Jan, 2012 19:24:10

Message: 3 of 5

Christope,

As you have figured out - the behavior is very specific to some older instruments.

When using VISA, there may be a way to send the instrument back to local mode using a SCPI command. You'd have to contact the manufacturer for the SCPI manual for that.

Another option is to write out the binary GPIB command to the VISA GPIB object.

This writes the LLO (Local LOckout), but there are similar GPIB commands you can find.
>> fwrite(device(1).obj, hex2dec('11')); % This writes LLO i.e., 0x11

Refer this for more info:http://www.hit.bme.hu/~papay/edu/GPIB/tutor.htm

or contact the instrument vendor for the specific commands.

-Vinod

"chris2k" wrote in message <jfu3ka$ifp$1@newscl01ah.mathworks.com>...
> Hello,
>
> at the moment I'm transferring some measurement functions from an old Pascal program to matlab, using an Agilent 82357B USB to GPIB adapter.
> To create a list of GPIB objects, I'm using the following code:
> address_dc = 5;
> device(1).obj = gpib('agilent',7,address_dc);
>
> If I open the connection to a device using "fopen(device(1).obj)", the device goes to "Remote" mode and back to "Local" when using "fclose(device(1).obj)", as desired.
> Unfortunately some devices will be reset when using "fopen(device(1).obj)", like the Anritsu 68187B RF generator or the HP438A power meter.
>
> If I use the "visa" function to create the GPIB objebt, the reset does not occur:
> address_dc = 5;
> device(1).obj = visa('agilent',['GPIB0::' int2str(address_dc) '::INSTR'])
>
> However now I have the problem, that the device stays ins "Remote" mode if I close the connection using "fclose".
>
> So I have the choice between using "gpib" and causing a reset or using "visa" and the device stays in "Remote"...
> Is there a special visa function to send the device back to "Local"? Or do you have a suggestion how to avoid the reset when using gpib?
>
> Thanks!
> Christoph

Subject: GPIB/VISA problem - fopen resets device

From: chris2k

Date: 27 Jan, 2012 20:06:10

Message: 4 of 5

Thank you very much for your quick answers,
I will try that on monday and give feedback.

Have a good weekend!
Christoph

Subject: GPIB/VISA problem - fopen resets device

From: dpb

Date: 27 Jan, 2012 20:42:41

Message: 5 of 5

On 1/27/2012 2:06 PM, chris2k wrote:
> Thank you very much for your quick answers,
> I will try that on monday and give feedback.

Looking at the Instrument Toolbox doc online for the visa-gpib object,
looks to me like all you need after the fopen() to your device is a
fwrite() call sending for your specific question the "RTL" command.

As the other responder says, check the documentation of the instrument
for implemented commands but I've never seen one so lacking as to be
missing the basic 488.1 command set.

--

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gpib chris2k 27 Jan, 2012 07:04:14
visa chris2k 27 Jan, 2012 07:04:14
fopen chris2k 27 Jan, 2012 07:04:14
reset chris2k 27 Jan, 2012 07:04:14
rssFeed for this Thread

Contact us at files@mathworks.com