05-29-2009 03:34 AM
Hi Baji,
I tried the method but it doesn't work, if i leave the new location (blank) and put the new location and click on the update button, it will still update as empty string. Can you advise on how to able to update after you put in the new location and click update button and still work? Please help! Attached the revised VI.
05-29-2009 08:52 AM
You have two major problems with your code you need to fix first.
1. Your outer while loop has a false constant wire to the stop terminal. That means the VI will run forever and can only be stopped by aborting the VI.
2. Your inner while loop has the stop terminal controlled by a button outside the loop. That means it will either run once if that button is true, or run forever if that button is false. Even if you change the state of the button, the inner while loop won't see it because the reading of that control occurs before the while loop. There is no reason you want to write to a file in a loop like that anyway. Perhaps you meant the inner loop to be a case structure?
Other tips,
1. Always give your controls a name and make the labels visible on the block diagram. You can make the label not visible on the front panel if you want. You have your update button which has no label showing on the block diagram. When I made the label visible to see what that control was, I saw the control had an empty name. By naming controls and making their labels visible on the BD, it is possible to know what that control is supposed to be just by looking at the block diagram. Otherwise you are forced to double click it and see what control is highlight on the front panel.
2. Make sure you wiring flows from left to write. It makes it easier to determine what direction the data is flowing by inspecting the block diagram. Also, use right-click/ Clean up wire to eliminate and unnecessary extra bends in the wiring.
05-29-2009 08:59 AM
05-29-2009 09:12 AM - edited 05-29-2009 09:14 AM
I meant left to "right".
LV 8.6 as the code cleanup tool which does wonders for straightening out code. I used it to clean up your code as well as fixing the problems I stated before.
Use this as the basis of your code.
I'm not sure you are using the correct architecture for this. I think you should be using something that is event based. As you have it now, the outer while loop will continuously run through the same data even when nothing changes.