LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write key value problem

Hello friends!

 

I have run into a problem. I have a dialog box VI which asks for a serial number for each connector. There is an End button on the same VI. Its purpose if to cancel the calling of subsequent MAC no dialog boxes and serial number dialog box and to write a value of false against the enabled status of the serial ports (including the current serial port, which is being scanned). What is happening is that the serial port  for which the end button is pressed gets a true written against its enabled state (COM Port 0 Enabled=TRUE) in the config file.

 

I have been trying to find the source of error but to no avail. So I finally ask for my dear friends help at NI.

 

I am attaching the two VIs (these are part of a project so they use a lot of other VI unrelated to the current problem) (kindly let me know if more VIs are required for debugging).

 

Thanks a lot for taking time out to let me out of my predicament.

0 Kudos
Message 1 of 3
(2,573 Views)

I found your code extremely difficult to follow because of your excessive use of sequence frames and local variables. All of the code you showed can be written without using sequence frames, and most, if not all of the local variables can be eliminated. This would make the code much easier to follow and debug. If you right-click on the sequence frame and select Replace -> Flat Sequence you will see what I mean. It seems you have a background in text-based coding. As it is, here's what I can say:

 

"Enter Serial Number" VI 

  • You are not properly using the event structure. For example, in your "End" event case you set a separate Boolean control and fire off the event for a value change in one of the cluster elements. Why? This second "End Loop" Boolean is competely superflous. Delete it. The cluster is not visible to the user, so they cannot change it. Place the code that's in that event case in the "End" event case, and place the "End" button in that event case and wire it out to the stop terminal of the loop. 
  • The "Serial No" value change event case is completeley unnecessary. You're writing the value that it's being changed to back to the control. It's already been changed!
  • Change the mechanical action of "OK1" to the default of "Latch When Released", and change the "Mouse Down" event case to "Value Changed". Place the "OK1" Boolean inside that event case. This event will fire when the user presses the button and lets go of the mouse button while the cursor is still on the button, adhering to standard user interfaces. Thus, if they want to cancel the button press they can. The way you have it, this is not possible.
  • The "Connector In" control is not necessary. All you're doing is writing its value to another control which is the big string input. Just make this big string input your terminal control, and delete the superflous "Connector In".
  • Frame 3 serves no purpose.
  • Frame 4 serves no purpose since at no other time do you actually write a True to "Cancel.


"LaunchSNM..."

  • Same comment regarding frames and local variables.
  • In Frame0 you do not need to use Build Array. Simply wire out the "Connector" element straight out of the loop and auto-index it to get your array automatically.
  • Use a shift register instead of a local variable to carry around a value in a loop. This pertains to your "Scan End" Boolean.
  • ...
Message 2 of 3
(2,552 Views)

Wow! ! That was great surgery. Thanks a lot. Your reply made me realize I still need a lot to learn. Thanks a lot again. I'll try to make you recommendations a permanent part of my programming. That was a real good assessment.

 

Have a very nice day!

0 Kudos
Message 3 of 3
(2,529 Views)