BBC BASIC for Windows
« Opening COM ports -- long delay »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:55pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Opening COM ports -- long delay  (Read 780 times)
g3nrw
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 74
xx Opening COM ports -- long delay
« Thread started on: Jul 21st, 2014, 07:17am »

Here is a simple program that tests the availabilty of a particular COM port once per second:

Code:
      timer% = 100
      t% = 0

      REPEAT
        WAIT 1
        timer% += 1
  
        IF timer% > 100 THEN
    
          t% += 1
          PRINT "                TIME = " + STR$(t%)
    
          timer% = 0
    
          port% = OPENUP("COM4: 115200,N,8,1")
    
          PRINT "port%= " + STR$(port%)
          CLOSE#0
    
        ENDIF
  
      UNTIL FALSE

 


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
User IP Logged

rtr
Guest
xx Re: Opening COM ports -- long delay
« Reply #1 on: Jul 21st, 2014, 08:33am »

on Jul 21st, 2014, 07:17am, g3nrw wrote:
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.
« Last Edit: Jul 21st, 2014, 08:38am by rtr » User IP Logged

g3nrw
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 74
xx Re: Opening COM ports -- long delay
« Reply #2 on: Jul 21st, 2014, 10:44am »

Thanks Richard. All understood and regrettably accepted!

--
Ian
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls