LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counter for amount of times loop is run

Hello All!

I'm writing a program that requiers the number of times an experiment is run, and in thise case the experiment is in a loop.
meaning that I'd like:

1. date time 0.5556
2. date time 0.4612
3. date time 0.3562


I already have the date time ### part, but I'm not sure how to make something increase.

I was thinking of using the formula node ressembling:

"int32 x,y;
x=0;
y=y+1;
x=y;"

but I'm not sure how it works... Along with not knowing how to wire it to pretty much anything.

Thanks!
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 1 of 11
(3,627 Views)
Maybe I don't understand the question, but if the experiment is in a loop, can't you just pull a wire off the "i"?

Eric
0 Kudos
Message 2 of 11
(3,617 Views)
A formula node will certainly work but if your experiment is run once per iteration of the loop, then use the loop iteration terminal. That's the little "i" you see in a while and for loop. You can wire an indicator to it. It is zero based (the first iteration is equal to 0) so you can just have a increment function add 1 to that. If the while loop may iterate more times than the experiment may run like if you start the experiment with a Boolean event, then use a shift register and increment the count when the event happens. Attached is a simple example that shows both.
Message 3 of 11
(3,617 Views)
The problem is actually... that I have no "while" or "for" loop.

I have a "case structure loop".

Description: If switch is clicked on : run Program --> "Count: 1"
Else (false) : wait 200 ms



conclusively... there is no "i".. did that clarify anything?
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 4 of 11
(3,593 Views)
Here's the attached file:
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 5 of 11
(3,586 Views)
If I understand what you want to do correctly, I think this should solve your problem...

Geoff
Message 6 of 11
(3,581 Views)
That sure looks like a while loop to me.;) The shift register in my example and Novatron's does the trick.
Message 7 of 11
(3,577 Views)
Ahhh! I've been attacked by the crappiness of labview 6.1... Can't open your file mate.

Could u either take a screenshot of your VI or convert it to 6.1 please...

Thanks 🙂
Aquaphire

---USING LABVIEW 6.1---
0 Kudos
Message 8 of 11
(3,572 Views)
Oops, sorry 'bout that. The "False" case just has the two tunnels connected together.
Message 9 of 11
(3,567 Views)
Here's a picture of Novatron's VI. A shift register is a basic element of LabVIEW programming. Most programs use them and they're almost essential to advanced programming.

Message Edited by Dennis Knutson on 06-30-2005 08:30 AM

Message 10 of 11
(3,568 Views)