Solved

RS232 Input For Barcode Reader .

Posted on 2001-08-30
10
3,090 Views
Last Modified: 2009-11-10
hi all,

I have buy a barcode reader which is use RS232( COM PORT )
for input.in windows i can use hyper terminal to view the scan result for the reader.

Question

In my Vb program , how can use the MS comm control to received the data from the reader. what i mean is how the data read from reader can display in text box in my program.

Could you kindly provide me the step or example do to this.


Thanks .




0
Comment
Question by:seemedp
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 1

Expert Comment

by:MHasnain
ID: 6443693
The bar code reader function is simple. It reads the bars and send input to the active control.

if you open notepad and try to read the barcode the information will appeaar in the notepad.

So if your application is active nd the control has the focus where you want the information from brcode reder, just read from barcode reader nd the resultant info will be entered in to the control.  Then you cn further pply you checks etc.
0
 

Author Comment

by:seemedp
ID: 6443749
hi mhasnain,

Yes i known what you mean, for normal reader just need to plug into keyboard ps2 port and the scan result will display in notepad, but for my reader in using Rs232 connect to pc ( com port ) and nothing will show in notepad .

what i need to knwon inside vb program how we can received the data from reader with (com1) and display in text box.
0
 
LVL 4

Expert Comment

by:mcoop
ID: 6444370
I suppose you could fake it...

assuming that your reader is sending plain ASCII, then why not convert each character in the comm.input buffer to a sendkey() string.   That way your app would look like it was coming in through the keyboard ... !

Of course - just like keyboard wedges - you would need to ensure that the correct app has the focus to receive the keystrokes !

Otherwise, you'll just have to write your own on comm event handler, as there is not much we can do by remote control - since we don't have the actual unit, or protocol info as a reference.
0
 
LVL 1

Expert Comment

by:MHasnain
ID: 6445881
Hi,
I think I've used rs232 barcode reader and after successfull driver installation it works same like the one which connect with keyboard on ps2 port.

check weather you have correct drivers poperly installed.

thanks.
0
 

Author Comment

by:seemedp
ID: 6447067
hi mhasnain,

I don,t have received any driver come with the unit and i have ask for driver with the supplier but their dot need any driver just use the windows hyper terminal.

if is it need driver could you please help me to find the driver or any web site can find it.

My reader model : QS20H (Denso)

Thanks
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 4

Expert Comment

by:mcoop
ID: 6447410
I had a look at the product page on the web...

http://www.denso.co.jp/EAP/text/qrcode/qs20htxt-e.html

And it doesn't seem to do anything unexpected- so they are probably right...

Plug it into hyperterminal (at the correct serial port settings!), and watch what comes out of the reader when you scan your preferred codes...

(of course if you are printing the barcodes - then you have a pretty good idea of what should be coming out as well!)

It will probably consist of a start character, a string that identifies the symbol set (Code39, UPC/EAN etc), another delimiter, then the barcode data string, another delimiter, possibly a checksum (as well as that embedded in the code), and finally a (usually user-selectable) CRLF.

In the manual, there will definitely be instructions for setting DIP switches, or sending config values up the serial port to configure the scanner options.


0
 
LVL 4

Expert Comment

by:mcoop
ID: 6447411
P.S.  I was looking at their blurb about QR (2-D) codes - very clever and your reader can use them...   extremely 'cool'.

0
 
LVL 4

Accepted Solution

by:
VincentLawlor earned 20 total points
ID: 6451690
Open a new VB project

Add a MSComm control and text box to the form

In the Form_Load add the following code

MSComm1.PortOpen = True
MSComm1.InBufferSize = 100 'This should be the lenght of the barcode.

In your Form_Unload add the following code
MSComm1.PortOpen = False

In the OnComm event of the MSComm control add the following code

Private Sub MSComm_OnComm ()
   Select Case MSComm1.CommEvent
   ' Handle each event or error by placing
   ' code below each case statement

   ' Errors add handlers for each
      Case comEventBreak   ' A Break was received.
      Case comEventFrame   ' Framing Error
      Case comEventOverrun   ' Data Lost.
      Case comEventRxOver   ' Receive buffer overflow.
      Case comEventRxParity   ' Parity Error.
      Case comEventTxFull   ' Transmit buffer full.
      Case comEventDCB   ' Unexpected error retrieving DCB]

   ' Events
      Case comEvReceive   ' Received RThreshold # of chars.
           'Clear Text1 if necessary
           'Text1.Text = ""
           Text1.Text = MSComm1.Input
   End Select
End Sub

'the default settings on the com port should be
9600 Baud
No parity
8 databits
1 stop bit
i.e. MSComm1.Settings = 9600,N,8,1
but check the user manual on your reader for the proper settings.

Vin.




0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6451693
By the way a note to MHasnain it is standard practice on this forum not to propose answers but to post comments.

Posting comments locks so other experts may not get to see the question. See:
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

Vin.
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6452582
Hey what's with the grade B ?

Vin.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now