Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Trying to Code for a Barcode Scanner

Trying to Code for a Barcode Scanner

Trying to Code for a Barcode Scanner

I probably should have posted this here initially. But I posted it in the C language section instead:

A while back, my brother found some abandoned items at his work place. One of the things he found was a barcode scanner. With me being more into computers and electronics than him, he figured I might have more use for it.

Apparently it's a SerialIO LaserChamp. It hooks up to a serial port, and connects to the scanner by a tip-ring-sleeve connector (tip to pin #2, ring to pin#3, and sleeve t pin #5).

I downloaded the developer guide PDF from SerialIO's website. I threw together some quick code using my old Borland library functions from bios.h, but I can't get much useful information out of the scanner.

The code was copied from an example file. If I take a battery out of the scanner and put it back in, the scanner initializes with legible text giving me the scanner ID, firmware version, etc. But everything I scan givers me the same output. It's always:
That's all I can get from it. The guide said to send it any character to wake it up, then send it the character 'W' to invoke the "Who" command (so I can see it's config info). But it doesn't seem to respond to any input.

Here's what I compiled:

#include  <bios.h>
#include  <conio.h>
#include  <dos.h>

#define DTR         0x01    // Data Terminal Ready
#define RTS         0x02    // Ready To Send
#define COM1PORT    0x0000  // Pointer to Location of COM1 port
#define COM2PORT    0x0002  // Pointer to Location of COM2 port
#define COM1        0
#define COM2        1
#define DATA_READY  0x100
#define FALSE       0
#define TRUE        !FALSE


int main( void )
	int in,out,status,DONE=FALSE;
	int far *RS232_Addr;

	/*  Determine port location of COM1.
		 0x40:0x00 = COM1 I/O port address
		0x40:0x02 = COM2 I/O port address
	RS232_Addr = MK_FP( 0x0040, COM1PORT );
	if( !*RS232_Addr )
		return -1;

	_bios_serialcom( _COM_INIT, COM1, SETTINGS );
	cprintf( "... BIOSCOM [ESC] to exit ...\n\r" );

	while( !DONE ){
		/*Reset DTR and RTS to prepare for send/receive of next character.*/
		outportb( *RS232_Addr + 4, DTR | RTS );

		/* Get status of com port.*/
		status =  _bios_serialcom( _COM_STATUS, COM1, 0 );

		if( status & DATA_READY ){
			/*There's a character on the port. Get it and echo.*/
			if((out=_bios_serialcom(_COM_RECEIVE, COM1, 0)&0x7F) != 0)
				putch( out );

		if( kbhit() )
			/* Key has been struck.  Get it and send to port.*/
			if( (in = getch()) == '\x1B' )
				/* User pressed ESCAPE.  Don't send to port.*/
				DONE = TRUE;
			/* Send character to com port.*/
			_bios_serialcom( _COM_SEND, COM1, in );

 return 0;

I've actually never coded anything for serial ports before, nor barcode scanners. I'd love to hear any insight on this!
Replies continue below

Recommended for you

RE: Trying to Code for a Barcode Scanner

Doing a quick search, it looks like there's more data from the mfgr's site:
It looks like they have some control codes that you might need (there's at least 3 PDF's)

RE: Trying to Code for a Barcode Scanner

So I printed out a couple of the bar code pages, and I can't get either of them to read. First I printed it out on plain paper. I figured there was just too much bleed. Then I tried heavyweight matte paper. They printed a lot more cleanly but it still won't read any of them.

RE: Trying to Code for a Barcode Scanner

Is this what you have?


'No longer manufactured' is often code for "doesn't work worth a crap".


I remember one of our MEs going nuts trying move a barcode scanner (old, simple) with an air cylinder, slow enough to meet the EE's spec of 15 inches/sec.
Nothing worked until the ME read the scanner spec, which stated a _minimum_ scan speed of 15 ips. Arrogant EE didn't bother to specify what the limit was.
I think the limit came from the limited buffer size; the scanner would record black/white for a certain period of time, at a constant rate in time,
then go back over the data array to figure out which bars were wide and which were narrow.
If the scanner was moved too slowly, you only got a partial scan and the checksum was wrong.

RE: Trying to Code for a Barcode Scanner

Yes! That is the one I have.

Gotcha. I'm just about ready to chalk it up to not working worth a crap.

Probably why it was abandoned in the first place.

RE: Trying to Code for a Barcode Scanner

Note that the one I cited sends its data via Bluetooth.
It's possible that the serial port is only used at the factory, and may be undocumented.

RE: Trying to Code for a Barcode Scanner

Were you able to pair with it, and/or connect, via Bluetooth?

RE: Trying to Code for a Barcode Scanner

I wasn't. I'm assuming mine is an older pre-Bluetooth model.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close