LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i do a forward and reverse sweep two independent variables

Hi,

  So I was looking through the post on how to do a forward and reverse sweep with a real-time x-y plot. I have a similar situation except that instead of sweeping (forward and reverse) of one variable, but instead two variables (in my case, I call it gate voltage G-S Volt and source-drain voltage S-D Volt). I understand how to do it with one variable as provided in previous posts, but I am caught when I add another variable to reverse sweep. I have attached my vi to this post. Any suggesstions is greatly appreciated. Thank you. Also, a little more details on my plot, I am plotting current vs gate voltage which forward and reverse sweepeing (gate and source-drain voltage)..

0 Kudos
Message 1 of 4
(2,597 Views)

jasonct,

 

It is very difficult to follow what your code is doing. It violates all of the style guide and good practice recommendation for LabVIEW code.

 

The diagram should fit on one screen. SubVIs can help.  Generally dataflow eliminates the need for sequence structures.  Stacked sequence structures in particular obscure the code. Local variables are prone to race conditions, violate dataflow, and are not needed for the uses you are making of them.  Wiring should go right to left, with minimal numbers of bends.   Comments documenting what you are doing are helpful to others looking at your code and to you next month when you wonder why you did it that way.

 

Lynn 

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

thank you Lynn for your suggestions. I am actually in the process in cleaning up this code because I do realize does need some dire need of cleaning but I when I wrote it, I wanted results because it works well enough for me but now that I am adding more processes, I will most likely create subvi's to make my block diagram cleaner. 

0 Kudos
Message 3 of 4
(2,563 Views)

I recommend that you look at the examples of state machines and Producer/Consumer design patterns which come with LV or which you can find by searching on this Forum.  From your description and my brief glance at your code I am sure that one of these would work well for you.  Since you are cleaning up the program anyway, switching to an architecture which is much more versatile, robust, and easy to maintain is well worth the bit of extra effort it might take.

 

SubVIs are not just to cleanup diagrams.  They should be used to encapsulate a functional block of code, particularly if it may be reused elsewhere.

 

Lynn 

Message 4 of 4
(2,555 Views)