LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

single frame sequence structure

Solved!
Go to solution

The following code came from the security system sample CLD exam.  I don't understand why a single frame sequence structure was used in this case?  Can anyone explaine?

 

Thanks in advance.

 

SS screen shot.JPG

0 Kudos
Message 1 of 4
(3,552 Views)

It's to prevent a race condition. Presumably, that indicator can get updated in another case, but the shift register would not. In that case you want to see if the indicator data is different before the indicator gets updated with the contents of the shift register. Without the frame the indicator could be updated before the local variable gets read.

 

I'm also kind of surprised to see the method being used to construct the path that way in a sample CLD exam. Paths should not be specified using strings. (Waving finger in the air) Bad programmer, bad programmer. 

Message 2 of 4
(3,543 Views)

Well, VI Joe,

 

It is to avoid race around condition :smileywink:

 

It makes sure that the data from the indicator Zone status Indicators is read through its local variable before a new data being written to the same indicator. 

 

Perhaps it could have been avoided by having a shift register for storing old data. But the developer might have thought that its unnecessary  to add another shift register for a simple value change comparison at a single case :smileyhappy:

Message 3 of 4
(3,539 Views)
Solution
Accepted by topic author VI_Joe
Although I do not know (even though I work at NI), that code looks like the kind of polling code that was common before the event structure showed up.  Proper use of the event structure would eliminate the need for the locals and this check.
Message 4 of 4
(3,492 Views)