?
Solved

Working with COM Ports

Posted on 2009-07-09
8
Medium Priority
?
950 Views
Last Modified: 2012-05-07
PLEASE READ THE UPDATES PLEASE READ THE UPDATES
PLEASE READ THE UPDATES PLEASE READ THE UPDATES

Hi Experts. Are you ready for your stupid question of the week?

I've never worked with COM Ports before.
I have a barcode scanner that is actually USB, and after installing a driver and following some instructions I have enabled a 'Virtual COM Port'. It shows up under Device Manager as 'Symbol USB COM Port Emulation' under 'Human Interface Devices'.

Anybody have a clue as to how to talk to this COM Port? I want to receive any barcode data it is receiving.

======================
UPDATE: This blurb from the Readme might help:
Custom serial communication applications can be developed to work over the
virtual COM port, like the normal PC serial port. Driver supports Win32 serial
communication APIs and applications that use these APIs will work over the
virtual port subject to the limitations listed in Section 9.

======================
UPDATE:
I downloaded the ComPort library from SourceForge:
http://sourceforge.net/projects/comport/
And got it to connect on COM1.
My problem now is, when I deploy my application, will it always be COM1? What if the user has put another serial device which is using COM1 (Please keep in mind that COM1 is being virtualised by some software)?
0
Comment
Question by:rfwoolf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 18

Expert Comment

by:Johnjces
ID: 24815912
Just out of curiosity, what make/model of scanner are you using?

We use bar code scanners all the time where I work. All of the USB scanners we have are HID type devices that emulate an added keyboard.  So when you scan a bar code, it is just like typing it into a keyboard. No fuss, no muss, no hassles. No com port programming etc.

If you can, I would look at a different make/model of scanner that works as above.

Look at http://www.posguys.com/barcode-scanner_3/

Lastly, USB to serial devices usually add a virtual type com port above the standard com1 and com2 found on PCs. It is unusual that it is set as COM1. But on another user's PC the USB com port could be be anything especially if they have a modem or serial ports on their PC which are already set as COM1 and/or COM2.

You would need a setup in your application that the user would set the com port setting that was assigned to the scanner after it was installed.

John
0
 
LVL 13

Author Comment

by:rfwoolf
ID: 24815971
Thanks John. This is the Symbol (now Motorola) DS6707. It is the USB version which works exactly like Keyboard input. But this is a problem in my application because how do I detect Keyboard Input separate from Barcode Scanner input? This is important for me. I opened a question about how to create a keyboard listener which would detect a PREFIX and SUFFIX string of 'START' and 'END' respectively and ThievingSix helped me write one but it came out with some problems, so I decided the best bet was to use a COM port instead.
Based on your experience developing applications for barcode scanners, do you have any advice for me? I will gladly open a new question if you ask me to.
0
 
LVL 13

Author Comment

by:rfwoolf
ID: 24816083
COM Port question
(Assuming I stick with COM Port and JohnJces doesn't have a brilliant idea on how to detect keyboard and scanner input separately):
===
The COMPort component comes with a nice Comport Terminal which works perfectly: I scan a barcode and it appears in the terminal.
Any idea on how to call an event once it has scanned something?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 18

Accepted Solution

by:
Johnjces earned 2000 total points
ID: 24816103
The only advice I can give is from the my experience in writting a couple apps that use keyboard type BC scanners. In those apps there would be specific fields that the user would jump to or enter into for bar code input. For multiple scans, like inventory, I did a start button and set the scanner to send a carriage return and line feed at the end of each scan that would in essence be like hitting the enter key. This would loop until the user clicked finished. Single entries would have to be when in a specific field. If they were on a name field and scanned a label, we would have bad data and I checked for numeric or numeric AND alpha data in such fields and would reject such... clear the bad text and set focus again on that edit.

It is tough and IMHO pretty impossible to distinguish real keyboard input from BC scanner input so I do understand the use of the COM port devices. But other users may need to have it set to any com port from 1 - XXX, so you would just need to add a com port setting in your app.

John

0
 
LVL 18

Expert Comment

by:Johnjces
ID: 24816149
Sorry..no brilliant ideas!

One question... can you design the labels being read? Or are they like UPC codes that are fixed.

John
0
 
LVL 13

Author Comment

by:rfwoolf
ID: 24816177
Yes we are designing the labels being read. They are 2D barcodes using the PDF417 symbology.
0
 
LVL 13

Author Comment

by:rfwoolf
ID: 24816197
Thanks for the advice John, I'm still saving up to come visit your Casino ;)
Here's some boring (probably) and irrelevant news about my local casinos:
-One of my local casinos sends me about 4 SMSs a week about their "equal chance" draws that they hold regularly and other similar promotions. Trouble is, word gets around and everyone is getting these SMSs.
-I spoke for about an hour to a croupier at a Casino and they say they get paid about the same as a "banker" but with a lot more perks. By "banker" I assume they mean bank teller or bank salesperson, as opposed to the multi-millionaire investment banker stereotype.
0
 
LVL 18

Expert Comment

by:Johnjces
ID: 24816343
Most all of the 'floor' positions are minimum wage or even less due to tips. Tips or tokes is what a lot of their income is based upon. Not sure what tellers make... depending upon the season here they can do pretty good. But it is not consistent.

Back to labels... we use a prefix on ours but I guess that was sort of like the start and stop you tried earlier. Maybe just do a Start, like with the characters BC or BC9 then a carriage return line feed after the BC read might do you.

Anyway... again, no brilliant ideas!

John
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question