From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count a bool-event (start-stop)

How can Labview count a event (in this case: start-stop) show the value, when the event was 1500 times made there have to be a message ans the counter has to be set to 0  
0 Kudos
Message 1 of 25
(2,961 Views)

There are several possibilities. You could use the event structure, you could use a while loop with shift registers or some other things.

Could you be a bit more precise?

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 25
(2,956 Views)

The problem is: I ´ve to set a counter in a program where a on-off-switch is. Now I try to count the times when I activate the switch to on. And when the value 1500 is reached there has to be shown a message and the counter have to be set to 0.

The program is a little bit older where I have to insert this  "counter". It´s Labview 5.1 and Windows 2000. 

0 Kudos
Message 3 of 25
(2,952 Views)
Ok - so I think you have to do it with boolean logic. You can detect the rising edge to increment the counter.
 
The picture attached shows what I mean. Due to the LV-version I use, I can't save it as LV 5.1, but I attach the vi too. Maybe there's someone who converts it.
 
Thomas

Message Edited by becktho on 07-06-2005 04:14 PM

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Download All
0 Kudos
Message 4 of 25
(2,948 Views)

Hi Thomas,

thank you very much. But there is a little problem: The small boxes at the right sites of the loops don't become blue. they are white????? and by the while loop there is not the same sign in the right corner.

Thank you for helping me very very much!

Claudia

0 Kudos
Message 5 of 25
(2,930 Views)
When the box is white, that means that the other case(s) of the case structure are unwired.  You need to go through each case and wire something to that tunnel.  Be careful to only wire things that will not negatively affect your program (i.e.  if you know a certain case will happen, don't wire something that will erase the value you want).

As for the sign in the bottom corner...I imagine you're referring to the stop condition.  While loops have two (well, three if you wire an error cluster to them) ways of stopping.  "Stop if true", and "Continue while true".  If you right click on it, you can select which one you want.
0 Kudos
Message 6 of 25
(2,927 Views)
I don't know why, but when I click on the stop condition nothing happens and I can't choose. and also it doesn't work. So I attache the vi . It would be nice if somebody could tell me my mistake.
0 Kudos
Message 7 of 25
(2,918 Views)

As mentioned by novatron, you have to set all outputs of a case-structure with a value, but you didn't do it (that's why you have the white squares on the right side of the case structure) and you also have no program code in there.

So here is a picture of my example with the other cases, so that you can correctly wire both of them (true AND false).

Hope this helps.

 

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 25
(2,910 Views)

Hi Thomas,

it works, but the counter only show 0 or 1 and doesn't count up to 1500.....

thank you so much.

Claudia

0 Kudos
Message 9 of 25
(2,903 Views)

I don't see any more problems in your vi, if the cases are wired correctly.

Could you post it again with the changes made?

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 10 of 25
(2,897 Views)