09-01-2006 04:51 PM
09-01-2006 05:08 PM
09-02-2006 11:29 AM
09-03-2006 11:23 AM - edited 09-03-2006 11:23 AM
@the German guy wrote:
This is my first event-thing I've done.
Let me point out another possible problem in your code. The way you use the local variable of "raising" to switch the second case leads to unpredicatable code dues to race conditions. For each iteration of the loop, there is no way to tell if its value is written first to the terminal or read from the local variable. It may not behave as you expect and the lower case can be either in sync or lag one iteration behind the rest of the code. We cannot know!
Proper execution order can be enforced with dataflow. You simply wire the two together, eliminating the local variable. Now you ensure that the lower case can only execute once the comparison has been made (image).

Whenever possible, it is recommended to "go with the dataflow"! 🙂
If you use locals, there is always a potential for race conditions which some newbie programmers "solve" by peppering the diagram with sequence structures to enforce the lost execution order. Why complicate the code is this manner if all you need is a simple 1D object: a wire? 😉
For a similar perspective, have a look at this older thread:
http://forums.ni.com/ni/board/message?board.id=170&message.id=112401#M112401
@the German guy wrote:
I really would need the counter to get back to data that was taken before a specific count.
Sorry, could you explain once more. I do not understand what you want to do here.
Message Edited by altenbach on 09-03-2006 09:25 AM
09-05-2006 06:44 AM
Thanks for the help. I was not able to have a look into it during the weekend as I was not in the office. But I'll sure give it a try somewhen this week and let you know if it worked.
Thanks again
09-05-2006 06:52 AM
Hey Guys,
Thanks again for your help. The "implies" really just looks like what I was searching for (you need to know what you are looking for, I didn't exactly). This should really work.
Yes, I think doing all in one loop would be fine. I just had seen some examples where the event structure was outside the main loop, so I copied that and gave it a try.
Thanks for the help.