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: 

Serial communication blocked by Date and Time dialog

Is there any particular reason why Open Serial.vi is set to run in the user interface?

 

We use the VI for backwards compatibility (and sometimes because we like refering to the port by using the port number...), and had to figure out why a serial write operation would hang whenever someone opened the date and time dialog of a date and time control...And the reason was that Open Serial.vi runs in the UI. Change that, and everything runs smoothly. It's not very practical to change library functions though...and was there a reason for this setting?

Message 1 of 5
(2,671 Views)

I guess its set to UI-Thread because otherwise it might block the other code in the VI Smiley Wink

 

 

Christian

0 Kudos
Message 2 of 5
(2,654 Views)

That is what it does with its current setting; as soon as the UI is busy somewhere it affects code that should not be affected (in this case serial communication).

 

I understand what you mean though, and in some cases that would be a valid argument, however putting just that serial VI in the UI, a VI that based on its use is bound to be called repeatedly by code that should not be affected by the UI,  just makes the likelyhood of a problem higher and the debugging harder.

0 Kudos
Message 3 of 5
(2,649 Views)
Why would you constantly be calling Open Serial? You should only be opening the serial port once in your code.
0 Kudos
Message 4 of 5
(2,644 Views)

As mentioned in the initial message this is due to use of the old style serial VIs...if you do a write or read with those it will lookup the VISA ref by calling the Open-VI....so as long as you use those VIs they will repeatedly call that VI, and they will freeze if the UI is busy because of the execution system that VI is set to be in.  I'm not saying that it is difficult to get around the problem - you can drop the old style, or edit the execution system settings...I'm just asking if this is just an oversight that causes the compatibility VIs to have a bug...or if there was a good reason for it. As it is right now all I did to remove the problem was to change the execution system setting on that VI (easier than to rewrite everything to use VISA refs in a different way).

Message Edited by Mads on 08-10-2009 09:37 AM
0 Kudos
Message 5 of 5
(2,639 Views)