LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Output With Timer (Simulation)

Hello everyone, I just learned how to make LabVIEW program a week ago. I try to make a simulation of Digital Output by LabVIEW (my attachment). In this simulation I have a slider as an input (0-10 V), two numeric control (upper limit and bottom limit), a waveform chart that plot those 3 value, and two boolean LED (P0.0 and P0.1) as an indicator. In this simulation you can fill any number (between 0-10) in the numeric control as a limit for your slider input. If the input from a slider exceed those upper and bottom limit then the boolean LED will turn on, P0.0 if exceed upper limit and P0.1 if exceed bottom limit. The problem is I don't know how to make timer for those boolean LED. As example:

1) Make an input from slider,

2) If input (1) exceed the upper limit,P0.0 will turn on for 5 second,then turn of for 10 second,

3) If in that 10 second you change the input back to normal (between upper and bottom limit) then P0.0 will stay turn of until the input from slider exceed the upper limit again,

4)If in that 10 second you didn't change the input (stay exceed the upper limit) then P0.0 will repeat the process (2) until you the input from slider back to normal.

(Same process for input that exceed the bottom limit).

Can you help me to make this timer? Thank You :smileyvery-happy: (I'm sorry I made a double post):newbie

 

Regards

Juventom

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

Hello Juventom,

 

As I understand it you want to be continuously checking the value of the sliding bar and comparing that to the upper and lower limit controls whilest also chaning the LED booleans to true for 5 seconds then false for 10 seconds if the sliding bar value is outside of the limits.

 

To do this you would probably be best using a parallel loop design, where you have 3 while loops in place of the one you have currently. Each one of these while loops would be responsible for a part of your program (e.g. the top one would display your values on the graph and the second one who check the sliding bar value against the upper limit and then turn on the LED, etc)

 

I've found this tutorial about multiple loop programs and I think you should look at the section entitled "Parallel Execution"

 

http://zone.ni.com/devzone/cda/tut/p/id/3749

 

This way you can use normal delay VIs but when they run they only pause that loop rather than the whole program.

 

Please let me know how you get on with this, and ask me if you need further help.

 

James W
Controls Systems Engineer
STFC
0 Kudos
Message 2 of 4
(2,307 Views)

I manage to get answer for this problem (Thanks to SKSarko), but this block diagram still has a problem. The boolean indicator (P0.0) turn on when input from slider exceed the upper limit in the 10th second NOT when input exceed the upper limit for 10 second. For example I have 4-8V as a bottom and upper limit. I start the input slider from normal (between 4-8V) for 9 second and I change the input slider exceed the upper limit (ex. 10V) in the 10th second, suddenly the boolean indicator P0.0 turn on despite it only exceed the upper limit for 1 second. Can you help me to fix this problem? Thanks

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

Hey Juventom,


You're headed in the right direction. Here's the basic structure you need, I believe this will need a case structure with a nested case structure and a single shift register to keep track of how long you are exceeding. You shouldn't be doing anything with the i, or loop counter, variable.

You need to check if it's exeeding, if not, reset your counters and set the boolean to false.

If it's exceeding, you can set boolean to true. If it's exceeding for more than 5 seconds, set the boolean for false. If it's exceeding for more than 15 seconds, reset everything and the next loop can just start again.

 

Regards,

 

Michael M

NI Americas | AE

NI.com/support | 1866-275-6964

 

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