LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why won't for loop execute?

Can anyone tell me why this for loop won't execute in "Security System".  Basically I was practicing for the  CLD exam by writing the "Security System" practice exam.  I wanted to try the Event-Driven State Machine with a queue.  My problem is that in the "Check Alarm", "Check Bypass", and "Check Tamper" states, I have a for loop which is indexed with 4 - 6 element arrays.  The for loop will not execute 6 times.  It won't even execute once.  It just skips over the for loop and outputs all boolean falses and zeros for the numeric values.  Is this a Labview glitch of some sort?

 

Thanks for any replies.

 

Matt Koebel

0 Kudos
Message 1 of 5
(3,277 Views)

Without looking at the code, my guess would be that one of the indexing inputs into the loop is 0. A for loop will only loop based on the smallest indexing input (an auto-indexing array or the N terminal), so if you have an empty auto-indexing array, the loop will run 0 times.


___________________
Try to take over the world!
Message 2 of 5
(3,274 Views)

tst wrote:

Without looking at the code, my guess would be that one of the indexing inputs into the loop is 0.


More precisely ".. is an array of size zero.

 

(1) Go to yout three boolean arrays and click on the 6th element to make the arrays size=6 with all FALSE. now make current values default and save the VI.

 

(2) You also need to wire the boolean arrays across all event cases  to ensure the current values are kept in the shift register. RIght now a change in one array resets the others to an empty array again.

 

(3) now initialize a boolean array containing six FALSE and initialize the shift registers with it. 

 

 

Message Edited by altenbach on 10-22-2008 11:55 AM
Message 3 of 5
(3,253 Views)

altenbach wrote:

tst wrote:

Without looking at the code, my guess would be that one of the indexing inputs into the loop is 0.


More precisely ".. is an array of size zero.


The off-the-top-of-my-head term I used was "indexing input", which I wanted to refer to both indexing arrays and the N terminal, which is why I used the terminology I used, although there's probably a better way of phrasing it.


___________________
Try to take over the world!
0 Kudos
Message 4 of 5
(3,243 Views)

Hi,

Well looking into the VI there were no booleans shifting in any of the events, Hence the for loop is not executing check out how your are shifting the booleans, once this is fixed your problem is solved. 

Regards
Aks

(Appreciate answers by giving KUDOS)
Hit the stars.............. sky is not the limit.
0 Kudos
Message 5 of 5
(3,204 Views)