From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Optimal GPIB commands sequence

Solved!
Go to solution

Hello everyone,

I have at least 5 different devices sharing the same bus and I am using GPIB for the communication with them.

I am looking for an optimal command sequence for communication like

for write *rst; *cls; some_command; read ; *wai (or *opt? *opt).

Additionally, GPIB communication occurs from a different VI's simultaneously (I am not an original developer of these programs).

Sometimes the program froze when one of the devices reveals the error of the command from the remote program (i.e. VI).

So, my idea is to prevent the error organizing a timetable for commands, I mean Check if device is busy, wait, if too long -- Cancel; send a command; read; wait until reads; make a mark that device is free for another command.

 

Thank you in advance for any suggestions.

Bests,

Dima

 

0 Kudos
Message 1 of 11
(4,448 Views)

Hi triarian1,

 

What exactly is your program doing?
What errors are you seeing?

0 Kudos
Message 2 of 11
(4,391 Views)

Do you have an idea, which command causes the error on the device ?

You might run NI IO-Trace to log the commands on GPIB. That log could reveal what happens just before the freeze.

0 Kudos
Message 3 of 11
(4,383 Views)

Hi sherlockholm,

Program is communicating with two waveform generators Aglient 33521A and Stanford DS345 which sending a sine waves into samples, two Lock-ins Stanford SR830 analyze the response from samples. There is also a capacitance bridge which measures temperature.

So, the process is as follows: waveform generators send a sine signal with some amplitude and frequency; lock-ins took response; program analyzes this response and we obtain the experimental data, also it is calculated whether it should be change driving frequency or not.

Error appears at Aglient generator which said: Error generated by remote interface.

I watched through the program, there is a GPIB Write command which set Frequency to Waveform Generator.

My guess is there could be two problems:

1) the bad value of Frequency is send to Waveform Generator (such as negative or so). I tried to fix this.

2) two or more commands are send to Waveform Generator without waiting for previous command proceed.

0 Kudos
Message 4 of 11
(4,380 Views)

Hi mkossmann,

That's a good idea. I did not know about IO-Trace.

Unfortunately, I can not find it on a PC.

We are using Labview 8.5 under Windows XP and either IO-Trace was not available in this version or it was not installed.

0 Kudos
Message 5 of 11
(4,379 Views)
Solution
Accepted by topic author triarian1

If you are using XP, you might also use an old version of the NI-Software. However in old versions of the NI-Software this program was called NI-Spy

0 Kudos
Message 6 of 11
(4,376 Views)

Thank you.

I turned it ON.

0 Kudos
Message 7 of 11
(4,374 Views)

Hi mkossmann,

After 40 hours of measurements the Error appears again. 

I saved the command and a few previous commands into error_log.png

I also attach the Labview window where error occurs W1.jpg as well as the previous window where data goes to storage W2.jpg

So, this particular part of the program communicates with the lock-in Stanford SR830 and as I understand at first 4000 points are saved into storage of this lock-in (W2.jpg). Further, those points are downloaded (W2.jpg) into an array and analyzed. During this downloading procedure the error occur.

 

Any ideas how to fix this?

Thank you

Download All
0 Kudos
Message 8 of 11
(4,354 Views)

What I realized from this error analysis is for some unidetifed reason lock-in stops responding and maybe I could say more if some reasonable timeout was set. Until now timeout was by default some huge number. I set everywhere timeout to 10 second which is not solving a problem.

Sequence right now is:

1) Turn on GPIB: OUTX1; Reset data buffer REST; Set sample rateSRATX;  sets or queries the end of buffer mode SEND0; Start data buffer read STRT

Then goes the pause, in my case 4 seconds to fill data buffer

2) Pause data storage PAUS; Queries the number of points in buffer SPTS?

After that program goes immediately to data read:

3) Data read TRCA?1 or TRCA?2 

So I think in the end of step2 I should put some command that will wait operations to be completed like *WAI.

I am not sure.

 

0 Kudos
Message 9 of 11
(4,348 Views)

How many times is that loop running?

Lets see, in hex you are sending an 0xFFFFFFFF im thinking that means put 4000 values into trace 1 storage starting at the highest addressable space.  I would expect something to complain about that


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 11
(4,338 Views)