JohnyQuick Posted December 23, 2013 Share Posted December 23, 2013 Sorry this question asked before maybe. I have a device and a sequence that handles a null protocol via a RS232 port. There is a problem that when DF closes, and then restarts, the port is "busy", such that the port cannot be reopened (by DF), and then the sequence doesnt work. However, if I allow about 10-20 seconds inbetween closing DF, and then restarting DF, the port is initialized, OK, and the sequence works. What can I do to script this problem out( in my document) so it doesnt occur, when a user stops, then restarts DF without waiting 20 seconds. Link to comment Share on other sites More sharing options...
AzeoTech Posted December 23, 2013 Share Posted December 23, 2013 This is because DAQFactory doesn't always completely quit when the user interface disappears. It still has to shut down all the background threads running, including those that maintain the serial port. My recommendation is to init the port manually in an autostart sequence, looping until it does so successfully: while(1) try device.mydevice.initcomm() break catch() delay(10) endcatch endwhile You might add a counter in there to display a message if it does initComm() more than 10 times or something, or perhaps display a page that says initializing. What will happen is DAQFactory will try and init the port. If its successful, the break statement executes and the loop is broken out of, executing the command after the endwhile. If there is a problem initing the port, the catch() will catch it, pause 10 seconds then try again until its successful. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.