Linux Reads Bar Codes
Bar codes printed on machine-readable labels simplify automatic identification of various things. The Linux kernel device driver module developed by Hewlett-Packard provides serial port access to an HP handheld wand-style bar code reader. An interface circuit is presented for connecting the wand to a PC serial port, and we develop software for reading the Bookland bar code. The Bookland bar code is used in the book trade for encoding the International Standard Book Number (ISBN). Because Bookland and the Universal Product Code (UPC) both use the European Article Number (EAN) bar code patterns for encoding decimal digits, it turns out that our software also decodes the UPC, widely used for groceries and other retail merchandise.
The Hewlett-Packard HBCS-A300 Bar Code Wand (Figure 1) brings out a 3-wire serial interface consisting of two power lines and a signal line. When provided with +5 Vdc power and ground, the open-collector signal line can be pulled up with a resistor to the positive rail so that it becomes a TTL-compatible logic level output. As the wand moves over a bar code pattern, the output signal from the wand is low for a white bar, high for a black bar. This logic level signal does not swing negative, and therefore is not RS-232-compatible. As it turns out, however, it doesn't have to be. Inside a PC, the RS-232 signal and control lines typically are connected to a 1489-type bipolar-to-TTL signal translator called an RS-232 receiver. Information from the wand passes correctly through a 1489-type signal translator because the signal translator's threshold voltages are +1 and +2 volts when the IC's response control pin is left open, as it normally is. In that configuration, the translator operates as an inverting buffer for TTL-compatible signals. A white-level input signal below +1 volts translates into TTL-compatible high at the UART input pin, while a black-level input signal above +2 volts translates into TTL-compatible low.
The wand cable is equipped with a DIN connector that Hewlett-Packard describes as a 5-pin connector. It is really a 6-pin DIN connector with the center pin omitted. Sometimes this kind of DIN connector is described as a 5-pin ``240 degree'' connector. The ``other'' 5-pin DIN connector, such as on the PC/AT keyboard, is the one you will get if you are not careful what you ask for; it has five pins arranged in a 180-degree arc. The socket that matches the Hewlett-Packard wand is a 6-pin DIN socket, such as Mouser catalog number 16PJ224, or Digi-Key 275-1020-ND.
Surplus bar code wands obtained from Electronic Goldmine, and also from All Electronics, had the DIN connector wired differently from the pin-out given in Hewlett-Packard's data sheet. Both pin-outs are shown in Figure 2. Different wiring could have been the result of engineering change or possibly manufacturing snafu. In any case, once the power and signal lines had been identified and properly connected, the surplus wands worked the same as new.
The wand responds to light and dark bars. A nonreflecting black bar results in a logic high (+5 volt) level output, while a reflecting white space results in a logic low (ground level) output. There is, however, more to the story. That quick description implies static behavior, but the wand's response is not static at all. Light-source control and light-sensor signal processing circuits located inside the wand appear to be identical to the circuit diagrammed in Hewlett-Packard's data sheet for the 24-pin special-purpose HBCC-0500 integrated circuit (see Figure 3). That circuit creates dynamic behavior. Whenever the wand sees no transition, either white to black, or black to white, it times out after a short delay, and the output reverts to the low (white) level. It turns out that this behavior simplifies processing of the video signal received from the wand. The timeout expires after a very short delay, so there is high probability that the output signal will be in a known state, the low (white) state, when the wand is first picked up to begin a scan. In our software, this timeout feature is also used to detect abnormal termination, such as occurs when the wand is lifted off early or stopped in the middle of a bar code. Even if the wand is stopped on a black bar the circuit quickly times out and the output reverts to the white (low) level.
|Contrast Security's Contrast Enterprise||Aug 30, 2016|
|illusive networks' Deceptions Everywhere||Aug 29, 2016|
|Happy Birthday Linux||Aug 25, 2016|
|ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs||Aug 24, 2016|
|Updates from LinuxCon and ContainerCon, Toronto, August 2016||Aug 23, 2016|
|NVMe over Fabrics Support Coming to the Linux 4.8 Kernel||Aug 22, 2016|
- Contrast Security's Contrast Enterprise
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- illusive networks' Deceptions Everywhere
- Happy Birthday Linux
- What I Wish I’d Known When I Was an Embedded Linux Newbie
- Tech Tip: Really Simple HTTP Server with Python
- New Version of GParted
- All about printf
- ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide