05-31-2016 09:42 PM
I have my program attached and what it does is that when I turn the boolean Purge Control button ON, my graph will show a square wave and when I turn the button OFF, my graph will show just a straight line. However what I want is that when I turn off my purge control for instance, I want to be able to see on my graph that my square wave is transitioning into a straight line and vice versa. When you run the program you can either just see a square wave generation or a straight line can't see both. How could I go about doing this? Any help is greatly appreciated.
05-31-2016 10:08 PM - edited 05-31-2016 10:11 PM
What part of Data Flow don't you understand? You have a Loop, inside of which is a Case Statement that produces a Signal that gets graphed, meaning the entire signal is plotted. Do you notice that every second, an entire 1-second's worth of data is plotted, overwriting what was there before?
And what are inside the two Case Statements? One says "Make a flat line 1 second long at 1KHz", while the other says "Make a 10Hz square wave 1 second long at 1KHz". If you plot the first, you get a flat line. If you plot the second, you get a Square Wave. By the rules of Data Flow, you always generate 1000 points of one of those two waveforms every second (depending on the position of the pushbutton when you enter the loop -- it doesn't matter what you do when you are inside the loop), so you can only see one of two things in the plot.
If you had used a chart, which has some history, you'd see Square, Flat, Flat, Square, etc. as you pushed the button, one second at a time.
if you want more control, learn DAQmx and stop using simple Express VIs that have limited flexibility. There's an excellent White Paper to get you started -- search the Web for "Learn 10 Functions in NI-DAQmx" and read the article that it finds. Post your code, we'll try to help.
Bob Schor
06-01-2016 07:21 PM - edited 06-01-2016 07:21 PM
06-01-2016 09:42 PM
Your VI is running so fast that any new values speeds through the chart history almost instantly.
Why are you using a formula node and text based code?
06-01-2016 09:58 PM
I have to usea formula node
06-01-2016 10:00 PM
Why would you have to use a formula node? Is it some sort of requirement for a class assignment? (And if so, why are they using LabVIEW to create text code.?)
Use real LabVIEW functions.
06-01-2016 10:08 PM
No I'm trying to use this program for a system that I want to run at my co-op workplace, I tried it using the square wave signal generator however for some reason my supervisor told me that I should do it using a formula node as it will give me more freedom to do what I want with it....
06-01-2016 11:04 PM
If you're the co-op and he is the supervisor, you are probably going to have to listen to what he tells you even though it is unfortunate because he obviously has no clue as to what he is talking about. He might as well have your start writing code in BASIC.
Attached is a version of your VI cleaned up using LV code. And a wait put in so it slows it down so you can see changes. There was one line in the formula node of mod(T,t); But I have no idea how that is supposed to be used since it isn't assigned to any variable. If it was used, then you would use the Quotient&Remainder function in LabVIEW to get the same results.
06-02-2016 02:39 AM