LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable frequency sweep problem

Hi everyone,

I would like to remotely control my my Rigol function generator. The code I am using is attached below. When I run the VI, I can enable the output as well as the frequency sweep easily. I would like to enable or disable the frequency sweep throughout my experiments. The problem I am facing is that I cannot disable the frequency sweep programmatically using the event structure. What could be  wrong? Any suggestions will be highly appprciated

Download All
0 Kudos
Message 1 of 4
(2,548 Views)

I think you are doing "too much" in your Event Structure.  You seem to be starting and running the entire Instrument, from Initialize to Configure Waveform to Sweep to Read to Close.  Is this what you want to do?  Have you considered having Enable Frequency Sweep do nothing more than save its value in a Shift Register, having the other buttons save their values, and having "One Button to Rule Them All" (called "Do Test") that runs the code sequence you show for Enable Frequency Sweep (Initialize through Close)?

 

The logic behind an Event Structure is "Do Nothing and take no CPU Time until an Event occurs, then handle the Event".  Changing Enable Frequency Sweep, to my mind, does not mean "Do an entire test", but "Change what I do when I (eventually) do an entire test".  I hope you see the distinction, and I hope this helps you with your project.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,527 Views)

You really should look into a State Machine.  It can help break things down a little better for you.  And I like Bob's idea of just having a single button called "Run Test".  You do not even need to store all of the other control's values in a shift register or handle their events.  Just read the controls directly in the states that care about them.


GCentral
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
0 Kudos
Message 3 of 4
(2,524 Views)

Hi,

Thank you so much Bob and Crossrulz. Your ideas were of great help. I implemented the State Machine architecture and it does tome  what I want. Thank you again,

Regards,

Opuk

0 Kudos
Message 4 of 4
(2,480 Views)