From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB read/wrire cause syntax error in HP 8341 sweeper

I am using GPIB write/read/recieve function to communicate with HP 8341B synthesized sweeper through HP 8757A saclar network analyzer.
Somtimes it works. Sometimes it always shows HP-IB syntax error on the 8341B indicator. Then the program is hold. why?
 
Wei Tong
0 Kudos
Message 1 of 6
(3,504 Views)
The instrument will report a syntax error when you send a command that does not have the correct syntax.Smiley Wink
 
The instrument probably needs to have it's error buffer cleared before it will process any more commands so you will have to find out which command you are sending is not correct. If you want to post your program, someone who is familiar with the instrument may be able to spot something. You can isolate it yourself. You can add a query of the error buffer to your code. The command is probably something like ERR?. You could also single step through your program to see when the error light on the instrument goes on. When it does, you've isolated the problem to a specific write.
0 Kudos
Message 2 of 6
(3,496 Views)
The program worked well some time ago.
 
If I using the highlight execution or single step, there is no error happening. So, it seems be some waiting-time problem. One of my collegue ever told me, that using VISA  function instead of GPIB may solve this problem. But, I don't know why.
 
Before sending  a command, the GPIB clear function is used.
0 Kudos
Message 3 of 6
(3,496 Views)

You might have a timing problem but you could also have a dataflow problem. Highlight execution and single step also change the execution order so if you don't have correct data flow, there might be operations in parallel that cause the error when run at normal speed. It is a pretty old instrument though, and it may have trouble keeping up with the commands you send with a fast pc.

I doubt that using VISA will actually cure the problem. VISA is higher level layer over the GPIB driver and the commands on the GPIB bus will be the same. Using VISA is a better choice for isntrument communication in general so you might want to give it a try.

I don't think you really need to do a GPIB clear before every write. Doing it once at the beginning of the program is enough.

 

0 Kudos
Message 4 of 6
(3,489 Views)
Yes, you right. The VISA doesn't work yet.
 
 
It puzzled me.
Two months ago, the program worked very well.
 
Now I use it again, it gives problem.  It seems nothing changed. (computer, system, instruments, programs  are the same as before.)
 
Attached please check the program library. The main program is "scanFreq_NetAnalyzer.vi", others are SubVI called by this VI.
 
This program is to aquire a trace of data from Analyzer. Often, the errors happens when subvi "get trace parmtrs-Tong.vi" running.
 
Sometimes, the data is still acquired even the error happens.  Most of times, nothing obtained.
0 Kudos
Message 5 of 6
(3,483 Views)
Since I don't have the instruments, I can't run your VI but I think you are calling GPIB Clear way too many times. I don't see any reason to call it anymore than once. You should also connect your error in/error out clusters. If you did that, you would catch any errors that might occur in the code and could get rid of all those sequence structures. A properly written LabVIEW program will depend on dataflow and not sequence structures.
0 Kudos
Message 6 of 6
(3,450 Views)