Main Page | File List | Globals | Related Pages

MSUtils - Microscan MS-3 Barcode Scanner API

Version 1.1

Author:
R. Pogge, OSU Astronomy Dept. (pogge@astronomy.ohio-state.edu)
Date:
2004 May 24 (initial version)

Overview

This is a simple C-language API for operating a Microscan MS-3 CCD barcode scanner connected via a serial port. Microscan provides no Linux APIs, but the serial command language is very simple and well-documented, so we created our own. These routines provide a mid-level application programming interface for basic barcode scanner control and reading. It is self-contained, with no code dependent on any of our instrument or data-taking system code. This should make it generically useful for a number of applications where a simple "read a barcode label" functionality is required.

For our purposes, we intend to use the scanner to decode Code 39 and Code 128/EAN symbologies, though other symbologies supported by the MS-3 units can be enabled if desired. The first application we intend is to use an embedded MS-3 CCD unit to scan barcodes attached to slit masks in the MODS spectrographs we are building for the Large Binocular Telescope.

The serial connection code can work transparently with direct serial connections, or with serial ports connected via a network serial port server, like the Comtrol DeviceMaster servers we use at OSU using TCP/IP protocol sockets. The choice of interface is defined by the port name syntax. See MSOpenPort() for details.

Barcode Scanner Configuration

The MS-3 CCD barcode scanner needs to be specially configured in firmware for "serial trigger" operation before it can be used with this API. In this mode, the scanner's laser stays off until it receives the serial trigger character, then it stays on until it either decodes a label or times out (the latter defined by the no-decode timeout), at which point it turns off. For use in an astronomical instrument where stray light is a problem the ability to keep the scanner off until needed is crucial.

To better interact with Unix serial ports, we disable the factory default preamble text (prepended to all data read from the scanner), and set the postamble to be \r (ASCII 13 = Ctrl+M), which is standard for most serial devices in the Unix world.

Scanner firmware configuration is most easily accomplished using the ESP software for provided by Microscan with a Windows PC. The base configuration commands we use are as follows, configured in this sequence:

<Zrd> Recover factory defaults <K470,1> Enable Code 39 symbology decoding [default] <K474,1> Enable Code 128/EAN symbology decoding <K140,0> Enable serial point-to-point operation <K200,4> Enable serial trigger mode <K201,X> Serial trigger character is X (ASCII 88) <K220,0,2> No-Decode Timeout interval is 2 seconds [default] <K141,0> Disable read text preamble <K142,1,^M> Read text postamble is Ctrl+M=\r=ASCII 13 <K714,1,NOREAD> Send "NOREAD" on decode timeout [default] <Z> Save these settings for powerup.
Defaults refer to factory default values. We assert these anyway just to be explicit. We also start the configuration by resetting to the factory defaults to ensure that we are not starting from some other, possibly conflicting configuration (i.e., we don't assume we know the past history of a particular scanner).

Compilation and Dependencies

The Make for this library compiles the code using g++. There are no external libraries required to link with libmsutils.a in its current version.

Notes

This code is still pretty crude. We don't yet have any way to parse replies from status or info queries, and just hand back the strings for the user to look at or deal with as best they can. Some standard queries will likely get their own function calls to make life simple for programmers.

Stay tuned...

Modification History

  2004 May 24 - part of a beta-test system evaluating the MS-3 CCD barcode
                scanner [rwp/osu]
  2004 May 31 - separated into its own standalone library [rwp/osu]
  

Generated on Tue Jun 8 13:54:23 2004 for SCL Microstep Controller API by doxygen 1.3.7