LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

program runs in strang way

I have this program running in strang way.
The program is trying to choose one column in listbox by either up down keybroad or mouse click. Then the program suppose to find the corresponding element in an 1D array. Once find it, show the index of the element in 1D array.
The strang thing is: click one column, the highlight column is jumping back and furth or delayed some time to move to the new selected column. It seems there is something wrong in loop.
Please help
  
0 Kudos
Message 1 of 7
(2,956 Views)

Sorry

The old attacment has no data when open it. Here is one with data 

0 Kudos
Message 2 of 7
(2,938 Views)

Could you put some reasonable default data into the array controls on the left so we can actually test. Then save it as development distribution so the missing subVI is also included in the llb.

So far, the VI does not make a lot of sense to me. Seems quite convoluted. Why do you have a delay in the FOR loop?

Message 3 of 7
(2,937 Views)
sorry my brain is dead really .
I forgot the subvi.
Here is my vis.
0 Kudos
Message 4 of 7
(2,931 Views)
please see my last post above yours
0 Kudos
Message 5 of 7
(2,930 Views)
You are really an expert. I put a 50 ms delay in for loop, it works.
0 Kudos
Message 6 of 7
(2,930 Views)


@detech wrote:
You are really an expert. I put a 50 ms delay in for loop, it works.



NO! That's NOT the solution!
 
You are creating a race condition by reading and writing value properties without need in the same node.
 
Suggestions (See attached, LabVIEW 7.1):
  • You only need to write the listbox content once outside the loop. It can never change during th run!
  • Use an event structure. The loop only needs to execute if the list selection changes.
  • You can use autoindexing for array2.
 
(sorry, I took the subVIs out so I can run it, just put them back in). See if this is clear! 🙂
0 Kudos
Message 7 of 7
(2,921 Views)