Comm32 Logo
Home Button  Buy Button 

Topic:   Gap between reads makes for slow response

By: Joe DaviesPosted on: Jan 11 2019 at 09:12:31 AM
Hi there I've purchased your OCX and got it all working. I'm using a barcode scanner connected to the RS232 port and it all worked fine in my development testing. Now that it is being used in real world scenarios I've discovered that if there is a 5 minute or more gap between scans the response time in reading the barcode and showing the value in the text box on our form can be anything between 10 and 15 seconds. The barcode is always successfully read but the response is very slow.
Is there a command I can pass to the comm control at regular intervals to keep it alive and responsive?
Thank you in advance!

By: Joe DaviesPosted on: Jan 11 2019 at 09:49:16 AM
I'm only reading data over the serial port I'm not sending any data. The data being read by the scanner are numbers prefixed by a letter T. Once the scanner has done a read and another barcode is immediately offered without any time delay the second response is instantaneous. If there has been a 5 minute gap between the last read then the response slows right down. What I'd like to know is there a method or command that can be used to keep the response times instantaneous every time. A sort of "keep alive" method which is sometimes used on web sites to keep them responsive.

By: GuestPosted on: Jan 11 2019 at 09:50:37 AM
Hello Joe.
The Comm control never goes to sleep as long as your program is running so I'm sure the delay isn't in the comm control.

It sounds like some hardware is going to sleep - maybe some energy saving mode where something is going into standby mode.

What kind of barcode scanner is it? Is it connected directly to a serial port? Or a USB port? or is it Wifi or BlueTooth device with virtual serial port?

If it's a wireless device then the device may work as soon as the user scans something but the computer port could still be asleep if it was setup to sleep after a period of inactivity. That might be configurable - ie disable sleep/wake-on so that the computer port is always awake.

What does your application do before displaying the value in the textbox? Does it write the value to disk? What happens if the disk has gone to sleep? That would need a few seconds to spin back up again before the program can move on.

We usually think of Barcode devices as being one way. But maybe you could send a string of zero's (null bytes) every so often. Test that to see if, (a) it has no negative effect on the scanner and (b) does it keep the port alive?

By: Joe DaviesPosted on: Jan 11 2019 at 10:50:44 AM
Thank you for the reply, the PC has an ssd drive and it's been set to never sleep. The barcode scanner is the Honeywell Orbit 7190g using serial to USB connection on a fixed comm port number. The program is always fully alert and is simply waiting for the oncomm event. You mention that the port may be configurable ie disable sleep/wake-on so that the computer port is always awake. Where can I find that setting? Thanks!

By: GuestPosted on: Jan 12 2019 at 04:50:53 AM
In Device Manager look at the bottom of the list and you see USB Serial Bus controllers. If you select any one of them you'll see a Power Management tab with an option to:- "Allow the computer to turn off this device to save power".

But I'm not convinced it's that. I don't know if Power management switches off the 5 Volt supply to the attached USB device - you say the barcode reader reads the barcode (visible beam and a beep maybe?) so you can see that the device is powered up.

As I said, I'm not convinced it's power management but I suppose it's worth disabling it just to see if it makes any difference.

I suppose there's two possibilities. You need to know which one we're dealing with.

As soon as the barcode is scanned the data arrives in the RXBuffer but there's a 10 second delay before the OnComm event is triggered.


When the barcode is scanned no data arrives in the RXBuffer until 10 seconds after the scan. SComm triggers the OComm event as soon as data arrives in the RXBuffer.

To test that I think what I'd do is add a timer on, say, 500ms and each time the timer triggers do not read the data. Just read the inbufferCount and display it in a textbox. That should give you a good idea of when data is arriving and how long the delay, if any, before SComm triggers the OnComm event.

By: Joe DaviesPosted on: Jan 13 2019 at 05:53:30 AM
Ok thanks for the reply I will try the timer approach and get back with my test results.

Reply - add a comment to this topic.

You may enter letters, numbers and standard punctuation only. HTML and other scripts/tags will be rejected.

Topic:- Gap between reads makes for slow response

Enter the numbers.

Your name here is optional