08-01-2013 06:57 AM
Sorry what a stupid mistake.....
08-01-2013 07:30 AM
Ok, you can use a local variable (to create one, just right click any control/indicator and select 'Create >> Local Variable')
Find the attached modified VI and let us know if it works for you.
08-01-2013 08:05 AM
Just one question and one mistake I noticed:
Why do two loops at all? If you want to take two pieces of data every 100 ms, just put them in the same loop.
Mistake: You have lengthened your while loop structure so it extends over the error path outside and the Close UDP and error handler VIs are "floating on top" (you can see the "shadow"). This makes it really hard to read. Never cover up one thing with something else if at all possible.
Cameron
08-01-2013 09:12 AM
Well yes that works! Thank you.
Actually I was inspired by a tutor book before and tried to use 2 globel variables and form another
while loop to make comparison, the idea of which is similar to yours but yours is obviously simpler
to handle. I really appreciate your kind help, thanks again moderator!
Chao
08-01-2013 09:17 AM
@jcraffael wrote:
Actually I was inspired by a tutor book before and tried to use 2 globel variables and form another
while loop to make comparison, the idea of which is similar to yours but yours is obviously simpler
to handle.
Local/Global variables should be avoided as they can cause RACE condition... however in your case, the requirement was just to read the value of an indicator from different loop, so I preferred simpler way to use the local variable.
08-01-2013 09:19 AM
Good question Cameron! it's a good idea to use only one loop. Because the UDP reader vi is actually a labview example
and i just copied it to have 2 blocks to receive data from 2 UDP ports without thinking of modifying the source code.
Besides, the covering error handler is also what the source code is like. But thanks for your suggestion!
Chao