Showing results for 
Search instead for 
Did you mean: 

Wait for signal generator to finish list sweep before sending next command

Go to solution

I am writing a program for an Agilent E4421B signal generator to perform a list sweep between a specified range of frequencies (ramping up to the maximum frequency and then back down to the initial frequency). The signal generator only holds a list of 401 points, which is a problem when I want to sweep over a large range of frequencies. To get around this, I would like to perform multiple list sweeps in a row. However, I cannot figure out an efficient way to "tell" the program to wait until the previous sweep has finished before sending a new sweep command to the signal generator. Any ideas? For reference,  I am using the Agilent ESG Series LabVIEW drivers.



0 Kudos
Message 1 of 5

I'd have to look at the drivers, but many instruments will use an OPC? command.  So you send the OPC? command and then wait for the instrument to respond.  The instrument isn't supposed to respond until it is done.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 5
Accepted by topic author lpsimpson90

If you were using standard VISA calls, I'd just say to send the sweep command but append ;*opc? (operation complete?) to it to make it a query.  Then execute a VISA read to read what comes back.  This instructs the equipment to send a 1 to the output buffer when it has completed the sweep (or just about any other operation, too).  Since you are waiting for a response, your computer will wait for the timeout amount for it to see a response, so there's your efficient way to with the exact amount of time - no less, no more - than it actually needs to take.


A few caveats:


1) Make sure the timeout is longer than the time it takes for your slowest sweep.


2) There are some variations of the "1" being sent back.  I've seen "1", "01" and even "1.00E+3" so allocate more than just one byte to read.

(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 3 of 5

Somehow I didn't know about the OPC command. Thanks for leading me in the right direction!

0 Kudos
Message 4 of 5

As far as I can tell, it works perfectly now. What a simple solution. Thank you!

0 Kudos
Message 5 of 5