LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop count in ON/OFF continuous while cycle

Hello everybody, good morning,

 

I would like some help to build my code. The VI basically switches an electric valve ON and OFF when the air pressure reaches a max limit and a min limit.

The problem is i would like to shut off the program when the VI does enough ON/OFF cycles, but i don't know how to do it with the code written like this.
Could you help me figure it out?
I'm not an expert, but i cannot see an efficient way.

Thank you very much

You can see the simple VII attached at the bottom
Cheers

0 Kudos
Message 1 of 5
(1,005 Views)

You need two shift registers...

 

One to keep a counter.

One to keep on\off state. If previous state was false and current state is true, increase counter.

 

If counter > nr of iterations, stop...

0 Kudos
Message 2 of 5
(1,002 Views)

How can i extrapolate the current on/off state and compare it to the previous one? Do i use the index?
Thank you

0 Kudos
Message 3 of 5
(970 Views)

@Ni_gas wrote:

How can i extrapolate the current on/off state and compare it to the previous one? Do i use the index?
Thank you


As wiebe@CARYA said you hold it in a shift register. Did you see the training materials at the top of this forum? When you are new to LabVIEW some basic training materials will save you a lot of trouble in the long run.

0 Kudos
Message 4 of 5
(962 Views)

I would use a feedback node for the on>off detection and a shift register for the count.

Also have a look at the "in range" function. Most likely you only need one shared variable and one case structure. If the value is out of range, and "in range?" output just changed, feed the output of the "less than" function to the shared variable, else execute the empty case.

 

(We typically can't work well with pictures. Next time please attach your VI.)

0 Kudos
Message 5 of 5
(926 Views)