BBC BASIC for Windows
Programming >> Operating System >> Opening COM ports -- long delay http://bb4w.conforums.com/index.cgi?board=os&action=display&num=1405927020 Opening COM ports -- long delay
Post by g3nrw on Jul 21st, 2014, 07:17am
Here is a simple program that tests the availabilty of a particular COM port once per second:
I have tested this by plugging/unplugging a USB-to-serial adapter into/from the COM4 port on a laptop, running Windows 7/32.
Logically it works OK, but when I plug the adapter into the PC, there is a very long delay (around 4-5 seconds) before the port open state is recognized -- the timer counter update freezes during this time. When I remove the adapter the state is recognized almost immediately.
Is there a way to reduce the OPENUP delay when the port becomes available?
-- Ian Re: Opening COM ports -- long delay
Post by rtr on Jul 21st, 2014, 08:33am
Is there a way to reduce the OPENUP delay when the port becomes available?
As I'm sure you appreciate, the delay has nothing whatever to do with BBC BASIC, so this isn't really the right forum on which to ask the question.
If you plug in a USB serial adapter Windows has a great deal to do. It must use the plug-and-play mechanism to detect the insertion of the device, identify what sort of device it is, locate and load the appropriate driver, initialise the device, allocate a COM number etc. etc.
It seems unlikely that there will be anything you can do to reduce the delay, but if there is you will need to enquire on an appropriate Windows/USB forum.
Incidentally the subject line "Opening COM ports - long delay" is rather misleading because the delay isn't related to opening the port (which is pretty much instantaneous) but in Windows detecting and installing the USB adaptor.
Richard.
Re: Opening COM ports -- long delay
Post by g3nrw on Jul 21st, 2014, 10:44am
Thanks Richard. All understood and regrettably accepted!