Two-out-of-five code

Last updated

2 of 5 barcode (non-interleaved) Barcode2of5example.svg
2 of 5 barcode (non-interleaved)
POSTNET barcode Correios CEP 22011-080 - Codigo de Barras - PU1JFC.jpg
POSTNET barcode

A two-out-of-five code is a constant-weight code that provides exactly ten possible combinations of two bits, and is thus used for representing the decimal digits using five bits. [1] Each bit is assigned a weight, such that the set bits sum to the desired value, with an exception for zero.

According to Federal Standard 1037C:

The weights give a unique encoding for most digits, but allow two encodings for 3: 0+3 or 10010 and 1+2 or 01100. The former is used to encode the digit 3, and the latter is used to represent the otherwise unrepresentable zero.

The IBM 7070, IBM 7072, and IBM 7074 computers used this code to represent each of the ten decimal digits in a machine word, although they numbered the bit positions 0-1-2-3-4, rather than with weights. Each word also had a sign flag, encoded using a two-out-of-three code, that could be A Alphanumeric, Minus, or + Plus. When copied to a digit, the three bits were placed in bit positions 0-3-4. (Thus producing the numeric values 3, 6 and 9, respectively.)

A variant is the United States Postal Service POSTNET barcode, used to represent the ZIP Code for automated mail sorting and routing equipment. This uses two tall bars as ones and three short bars as zeros. Here, the weights assigned to the bit positions are 7-4-2-1-0. Again, zero is encoded specially, using the 7+4 combination (binary 11000) that would naturally encode 11. This method was also used in North American telephone multi-frequency and crossbar switching systems. [3]

The USPS Postal Alpha Numeric Encoding Technique (PLANET) uses the same weights, but with the opposite bar-height convention.

The Code 39 barcode uses weights 1-2-4-7-0 (i.e. LSB first, Parity bit last) for the widths of its bars, but it also encodes two bits of extra information in the spacing between bars. The || ||| spacing is used for digits.

The following table represents decimal digits from 0 to 9 in various two-out-of-five code systems:

DigitTelecommunication
01236
POSTNET
74210
PLANETCode39
bar widths
12470
11100000011 POSTNET 1.svg ┃┃┃╻╻|||
21010000101 POSTNET 2.svg ┃┃╻┃╻|||
31001000110 POSTNET 3.svg ┃┃╻╻┃▮ ▮ |||
40101001001 POSTNET 4.svg ┃╻┃┃╻|||
50011001010 POSTNET 5.svg ┃╻┃╻┃|||
61000101100 POSTNET 6.svg ┃╻╻┃┃| ▮ ▮ ||
70100110001 POSTNET 7.svg ╻┃┃┃╻||| ▮ ▮
80010110010 POSTNET 8.svg ╻┃┃╻┃|||
90001110100 POSTNET 9.svg ╻┃╻┃┃|||
00110011000 POSTNET 0.svg ╻╻┃┃┃|| ▮ ▮ |
A1––10IBM 707x
Sign flags
1––01
+0––11
Digit01234
IBM 707x

The limit on the number of bits set is similar to, but strictly stronger than, a parity check. All constant-weight codes, including the two-out-of-five code, can not only detect any single-bit error, but also detect any unidirectional errors -- any case where all errors in a codeword are of a single type (0→1 or 1→0).

See also

Related Research Articles

Binary-coded decimal System of digitally encoding numbers

In computing and an electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually four or eight. Sometimes, special bit patterns are used for a sign or other indications.

In mathematics and computing, the hexadecimal numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, hexadecimal uses 16 distinct symbols, most often the symbols "0"–"9" to represent values 0 to 9, and "A"–"F" to represent values from 10 to 15.

A computer number format is the internal representation of numeric values in digital device hardware and software, such as in programmable computers and calculators. Numerical values are stored as groupings of bits, such as bytes and words. The encoding between numerical values and bit patterns is chosen for convenience of the operation of the computer; the encoding used by the computer's instruction set generally requires conversion for external use, such as for printing and display. Different types of processors may have different internal representations of numerical values and different conventions are used for integer and real numbers. Most calculations are carried out with number formats that fit into a processor register, but some software systems allow representation of arbitrarily large numbers using multiple words of memory.

Universal Product Code Barcode symbology used for tracking trade items in stores

The Universal Product Code is a barcode symbology that is widely used worldwide for tracking trade items in stores.

A binary code represents text, computer processor instructions, or any other data using a two-symbol system. The two-symbol system used is often "0" and "1" from the binary number system. The binary code assigns a pattern of binary digits, also known as bits, to each character, instruction, etc. For example, a binary string of eight bits can represent any of 256 possible values and can, therefore, represent a wide variety of different items.

Bi-quinary coded decimal Numeral encoding scheme

Bi-quinary coded decimal is a numeral encoding scheme used in many abacuses and in some early computers, including the Colossus. The term bi-quinary indicates that the code comprises both a two-state (bi) and a five-state (quinary) component. The encoding resembles that used by many abacuses, with four beads indicating either 0 through 4 or 5 through 9 and another bead indicating which of those ranges.

POSTNET is a barcode symbology used by the United States Postal Service to assist in directing mail. The ZIP Code or ZIP+4 code is encoded in half- and full-height bars. Most often, the delivery point is added, usually being the last two digits of the address or PO box number.

CPC Binary Barcode is Canada Post's proprietary symbology used in its automated mail sortation operations. This barcode is used on regular-size pieces of mail, especially mail sent using Canada Post's Lettermail service. This barcode is printed on the lower-right-hand corner of each faced envelope, using a unique ultraviolet-fluorescent ink.

Chen–Ho encoding is a memory-efficient alternate system of binary encoding for decimal digits.

International Article Number Standard barcode system used in global trade

The International Article Number is a standard describing a barcode symbology and numbering system used in global trade to identify a specific retail product type, in a specific packaging configuration, from a specific manufacturer. The standard has been subsumed in the Global Trade Item Number standard from the GS1 organization; the same numbers can be referred to as GTINs and can be encoded in other barcode symbologies defined by GS1. EAN barcodes are used worldwide for lookup at retail point of sale, but can also be used as numbers for other purposes such as wholesale ordering or accounting. These barcodes only represent the digits 0–9, unlike some other barcode symbologies which can represent additional characters.

Densely packed decimal (DPD) is an efficient method for binary encoding decimal digits.

Non-standard positional numeral systems here designates numeral systems that may loosely be described as positional systems, but that do not entirely comply with the following description of standard positional systems:

MSI Barcode Barcode symbology

MSI is a barcode symbology developed by the MSI Data Corporation, based on the original Plessey Code symbology. It is a continuous symbology that is not self-checking. MSI is used primarily for inventory control, marking storage containers and shelves in warehouse environments.

Decimal floating-point (DFP) arithmetic refers to both a representation and operations on decimal floating-point numbers. Working directly with decimal (base-10) fractions can avoid the rounding errors that otherwise typically occur when converting between decimal fractions and binary (base-2) fractions.

Intelligent Mail barcode

The Intelligent Mail Barcode (IMb) is a 65-bar barcode for use on mail in the United States. The term "Intelligent Mail" refers to services offered by the United States Postal Service for domestic mail delivery. The IM barcode is intended to provide greater information and functionality than its predecessors POSTNET and PLANET. An Intelligent Mail barcode has also been referred to as a One Code Solution and a 4-State Customer Barcode, abbreviated 4CB, 4-CB or USPS4CB. The complete specification can be found in USPS Document USPS-B-3200. It effectively incorporates the routing ZIP code and tracking information included in previously used postal barcode standards.

In computing, decimal32 is a decimal floating-point computer numbering format that occupies 4 bytes (32 bits) in computer memory. It is intended for applications where it is necessary to emulate decimal rounding exactly, such as financial and tax computations. Like the binary16 format, it is intended for memory saving storage.

In computing, decimal64 is a decimal floating-point computer numbering format that occupies 8 bytes in computer memory. It is intended for applications where it is necessary to emulate decimal rounding exactly, such as financial and tax computations.

BCD, also called alphanumeric BCD, alphameric BCD, BCD Interchange Code, or BCDIC, is a family of representations of numerals, uppercase Latin letters, and some special and control characters as six-bit character codes.

Industrial 2 of 5. is a variable length, discrete, two width symbology. Industrial 2 of 5 is a subset of two-out-of-five codes.

Matrix 2 of 5

Matrix 2 of 5 is a variable length, discrete, two width symbology. Matrix 2 of 5 is a subset of two-out-of-five codes. Unlike Industrial 2 of 5 code, Matrix 2 of 5 can encode data not only with black bars but with white spaces.

References

  1. Military Handbook: Encoders - Shaft Angle To Digital (PDF). United States Department of Defense. 1991-09-30. MIL-HDBK-231A. Archived (PDF) from the original on 2020-07-25. Retrieved 2020-07-25. (NB. Supersedes MIL-HDBK-231(AS) (1970-07-01).)
  2. PD-icon.svg This article incorporates  public domain material from the General Services Administration document: "Federal Standard 1037C".
  3. "Vintage Telephone Equipment Museum — XBR #5 MTF Relay Equip". SimpleThinking.com. Archived from the original on 2006-03-16.