Blog Archive

Monday, May 15, 2023

05-14-2023-1944 - A two-out-of-five code

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:

  • each decimal digit is represented by a binary numeral consisting of five bits of which two are of one kind, called ones, and three are of the other kind, called zeros, and
  • the usual weights assigned to the bit positions are 0-1-2-3-6. However, in this scheme, zero is encoded as binary 01100; strictly speaking the 0-1-2-3-6 previously claimed is just a mnemonic device.[2]

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:

Digit Telecommunication
01236
POSTNET
74210
PLANET Code39
bar widths
12470
1 11000 00011 POSTNET 1.svg ┃┃┃╻╻ ▮ | | | ▮
2 10100 00101 POSTNET 2.svg ┃┃╻┃╻ | ▮ | | ▮
3 10010 00110 POSTNET 3.svg ┃┃╻╻┃ ▮ ▮ | | |
4 01010 01001 POSTNET 4.svg ┃╻┃┃╻ | | ▮ | ▮
5 00110 01010 POSTNET 5.svg ┃╻┃╻┃ ▮ | ▮ | |
6 10001 01100 POSTNET 6.svg ┃╻╻┃┃ | ▮ ▮ | |
7 01001 10001 POSTNET 7.svg ╻┃┃┃╻ | | | ▮ ▮
8 00101 10010 POSTNET 8.svg ╻┃┃╻┃ ▮ | | ▮ |
9 00011 10100 POSTNET 9.svg ╻┃╻┃┃ | ▮ | ▮ |
0 01100 11000 POSTNET 0.svg ╻╻┃┃┃ | | ▮ ▮ |

A 1––10 IBM 707x
Sign flags
1––01
+ 0––11
Digit 01234
IBM 707x

The requirement that exactly two bits be set is strictly stronger than a parity check; like all constant-weight codes, a two-out-of-five code can detect not only any single-bit error, but any unidirectional error -- cases in which all the individual bit errors are of a single type (all 0→1 or all 1→0).

See also

References


  • 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).)

  • Public Domain This article incorporates public domain material from Federal Standard 1037C. General Services Administration. Archived from the original on 2022-01-22.

    1. "Vintage Telephone Equipment Museum — XBR #5 MTF Relay Equip". SimpleThinking.com. Archived from the original on 2006-03-16.


    https://en.wikipedia.org/wiki/Two-out-of-five_code

    The C0 and C1 control code or control character sets define control codes for use in text by computer systems that use ASCII and derivatives of ASCII. The codes represent additional information about the text, such as the position of a cursor, an instruction to start a new line, or a message that the text has been received.

    C0 codes are the range 00HEX–1FHEX and the default C0 set was originally defined in ISO 646 (ASCII). C1 codes are the range 80HEX–9FHEX and the default C1 set was originally defined in ECMA-48 (harmonized later with ISO 6429). The ISO/IEC 2022 system of specifying control and graphic characters allows other C0 and C1 sets to be available for specialized applications, but they are rarely used. 

    https://en.wikipedia.org/wiki/C0_and_C1_control_codes

    https://en.wikipedia.org/wiki/Control_character

    https://en.wikipedia.org/wiki/In-band_signaling

    https://en.wikipedia.org/wiki/Code_point

    https://en.wikipedia.org/wiki/Grapheme

    https://en.wikipedia.org/wiki/Graphite

    https://en.wikipedia.org/wiki/Control_rod

    https://en.wikipedia.org/wiki/Shear_pin

     

    https://en.wikipedia.org/wiki/Diamond

    https://en.wikipedia.org/wiki/Hexagon

    https://en.wikipedia.org/wiki/Standard_52-card_deck

     

    https://en.wikipedia.org/wiki/Blood_diamond

    https://en.wikipedia.org/wiki/Diamond

     

    Diamond is a solid form of pure carbon with its atoms arranged in a crystal. Solid carbon comes in different forms known as allotropes depending on the type of chemical bond. The two most common allotropes of pure carbon are diamond and graphite.

    https://en.wikipedia.org/wiki/Diamond

    Cleavage111 (perfect in four directions)

    https://en.wikipedia.org/wiki/Diamond

    DiaphaneityTransparent to subtransparent to translucent

    https://en.wikipedia.org/wiki/Diamond


    Isotropic
    Refractive index2.418 (at 500 nm)

    https://en.wikipedia.org/wiki/Diamond

    BirefringenceNone
    PleochroismNone

    https://en.wikipedia.org/wiki/Diamond

    The equilibrium pressure varies linearly with temperature, between 1.7 GPa at 0 K and 12 GPa at 5000 K (the diamond/graphite/liquid triple point).[10][11]

    https://en.wikipedia.org/wiki/Diamond

     

     

     

    No comments:

    Post a Comment