Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TAB key in Code128 barcodes

I'm trying to create a barcode with a "TAB key" within it.

(It seems as though some generators use ~ as a TAB key.)

I've read that Code128 supports ASCII, meaning "HT" should work as a Horizontal Tab. But I can't seem to get it to work.

How do I store a HT character in a Code128 that will decode to a TAB key press?

like image 801
Nir Tzezana Avatar asked Jun 17 '15 15:06

Nir Tzezana


People also ask

How do you enter a barcode key?

Creating the BarcodeSelect the desired data source in the barcode you want to encode the "enter/return" keyboard input. Click the insert special symbol or special character button. Go to the control characters tab. Select carriage return (CR) and click insert.

How do you read Code 128 barcodes?

Each symbol in the barcode is composed of three bars and three spaces. Each bar or space is 1, 2, 3 or 4 units wide, the sum of the widths of bars must be even (4, 6 or 8 units), the sum of the widths of the spaces must be odd (3, 5 or 7 units), and total 11 units per symbol.


2 Answers

Generating a Code 128 containing an ASCII control character

Code 128 can be used to encode any character in the Latin-1 character set, including ASCII control characters (ordinals 0 to 31).

Here is a Code 128 barcode representing a lone HT character (ASCII value 9):

Code 128 of "HT" character

The internal encoding uses code set A and contains these code words:

[103/START-A] [73/HT] [73/check-digit] [106/STOP]

General effect of scanning barcodes containing ASCII control characters

Scanning any type of barcode containing ASCII control characters may not give the intended result due to the diverse ways that the barcode contents may be provided to the system. Each method will provide different ways to configure how control codes are presented to your application.

A hardware reader might be configured in "keyboard wedge" mode where the device emulates a physical keyboard by generating keyboard scan codes. In this case you can usually configure the device to provide specific "key sequences" before and after scanning, as well as provide a mapping from the Latin-1 ordinals (0-255) represented in a barcode to the physical scan codes read by the keyboard interface, For example, in a particular application one might choose to map Carriage Return (ASCII 13) to the Down Arrow (5000) scan code. This text describes the relationship between ASCII control characters and scan codes.

Alternatively a hardware or software reader may use a driver. There is a lot of variation with this approach but often they provide a synthetic RS232 interface (perhaps over USB) or hook into the OLE subsystem of the operating system. In the most basic case scanning a barcode would be equivalent to pasting some text into a textfield – you may require the device/software to perform some kind of translation of the raw barcode data and you may also need to modify the application to react appropriately to the input.

Consider for example that the result of pasting some text containing a HT character into a text field isn't necessarily the same as manually typing that same text on the keyboard, i.e. at some point actually pressing the TAB key. When pasting the text the result would likely be that the initial field would contain the full text including the literal HT character. When typing the text manually the result would likely be that the leading input goes into the initial field, then the TAB key-press results in a change of focus to the next field in the tab order, which the remainder of the text will populate.

A barcode reader's documentation should describe the interfaces available and methods for customising the presentation of scanned data.

like image 67
Terry Burton Avatar answered Oct 04 '22 03:10

Terry Burton


@terry-burton - You gave an excellent response for the answer. Your write up provided me direction to where I needed to look for my answer. To solve my problem, and possibly to answer @nir-tzezana question, I found my answer in the scanner's documentation.

Correct barcode - I first ensured that my code128 was properly formatted and included the ASCII code for 'tab'. In my situation I have a number of tabs set inside a large string so I can quickly scan one barcode code and have multiple cells in excel populated.

Enable Function Key Mapping - Our environment uses Symbol LS2208 scanners. I obtained this manual and printed manual the page 7-14. In particular, I needed to enable 'Enable Function Key Mapping' on the device. If you refer to the table found on page 7-15 you'll see that the 'tab' key can be overused depending on the scanner setting. By making this change my scanner can now successfully parse the following string into correct cells.

Example:

MyCode128Function("Text123".Chr(9)."Text456".Chr(9)."Test789")
like image 43
Jeff Nichols Avatar answered Oct 04 '22 03:10

Jeff Nichols