From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuously running a subprogram with the main program

Thank you, GerdW and Altenbach for your insights.

 

May I know why you term self-start XControl as a "horrible kludge" and not to be used? Is it because of unconventional structure, or with inefficient CPU processing, or so... I thought XControl is event-based.

Regards,

Pradeep.

0 Kudos
Message 11 of 13
(289 Views)

A built application should never be in edit mode. It should run when opened and close when everything is done. (Name any other windows application that you stop and restart. It does not exist)

 

Xcontrols dramatically increase code complexity and introduce many more places for bugs to hide. They are mostly there for backwards compatibility (NI actually tried discontinued them for LabVIEW NXG!)

 

A proper state machine architecture leaves plenty of opportunities to create an idle state that can simulate "doing nothing" in a much more controlled environment. You are trying to solve a problem that does not really exist.

0 Kudos
Message 12 of 13
(271 Views)

I agree with altenbach - there is no need for an Xcontrol. You Zscan program is screaming for a state machine. There are currently numerous places where it could get stuck. You have WHILE loops which do not have a way to exit if the value is never read on the port. You have sequence structures inside sequence structures and WHILE loop inside FOR loop. Build a state machine with a start button to go from the idle state.

Message 13 of 13
(231 Views)