条码规范——Code 93

来源:互联网 发布:写频软件 编辑:程序博客网 时间:2024/06/07 20:55

CODE 93 BACKGROUND INFORMATION

Code 93 was designed to complement and improve upon Code 39. Code 93 is similar in that it, like Code 39, can represent the full ASCII character set by using combinations of 2 characters. It differs in that Code 93 is a continuous symbology and produces denser code. It also encodes 47 characters compared to Code 39's 43 characters.

A typical Code 93 bar code is:

Code 93 is a continous, variable-length symbology.

COMPUTING THE CHECKSUM DIGIT

Code 93 always includes two check characters which are referred to as "C" and "K". These two check characters immediately follow the encoded message itself and immediately precede the final stop character.

The "C" checksum character is the modulo 47 remainder of the sum of the weighted value of the data characters. The weighting value starts at "1" for the right-most data character, 2 for the second to last, 3 for the third-to-last, and so on up to 20. After 20, the sequence wraps around back to 1. In the above example (TEST93), the "C" checksum would be calculated as follows:

    DATATEST93VALUE2914282993WEIGHT654321WEIGHTED SUM1747011287183

Thus the sum of the individual weighted sums is 174 + 70 + 112 + 87 + 18 + 3 = 464. Modulo 47 gives a value of 9 with remainder 41. The value 41 is associated with the plus (+) sign, so the "C" check character would be encoded using the plus symbol encodation from the table below.

The "K" checksum character is calculated in basically the same way except that the weighting goes from 1 to 15. Also, the right-most character is now the "C" checksum character which was calculated in the step above.

    DATATEST93+VALUE291428299341WEIGHT7654321WEIGHTED SUM2038414011627641

Thus the sum of the individual weighted sums is 203 + 84 + 140 + 116 + 27 + 6 + 41 = 617. Modulo 47 gives us a value of 13 with a remainder of 6. The value 6 is associated with the ASCII character "6", so the "K" check character would be encoded using the "6" symbol encodation from the table below.

ENCODING THE SYMBOL

Once the checksum digit has been calculated we know the entire message which must be encoded in the bars and spaces. Continuing with our example, we will encode, from zero, the Code 93 bar code we used in our example above: HI345678with a checksum digit of 67.

In the following text, we will discuss the encoding of the bar code by considering that the number "1" represents a "dark" or "bar" section of the bar code whereas a "0" represents a "light" or "space" section of the bar code. Thus the numbers 1101 represents a double-wide bar (11), followed by a single-wide space (0), followed by a single-wide bar (1). This would be printed in the bar code as:


STRUCTURE OF A CODE 93 BARCODE

A Code 93 bar code has the following structure:

  1. A start character , represented below by the asterisk (*) character.
  2. Any number of characters encoded from the table below.
  3. The "C" and "K" checksum digits calculated as described above and encoded using the table below.
  4. A stop character, which is a second asterisk character.

CODE 93 ENCODING TABLE

VALUECHARACTERENCODINGVALUECHARACTERENCODING0010001010024O1001011001110100100025P1000101102210100010026Q1101101003310100001027R1101100104410010100028S1101011005510010010029T1101001106610010001030U1100101107710101000031V1100110108810001001032W1011011009910000101033X10110011010A11010100034Y10011011011B11010010035Z10011101012C11010001036-10010111013D11001010037.11101010014E11001001038SPACE11101001015F11000101039$11100101016G10110100040/10110111017H10110010041+10111011018I10110001042%11010111019J10011010043($)10010011020K10001101044(%)11101101021L10101100045(/)11101011022M10100110046(+)10011001023N101000110-* Start/Stop101011110

Note that the characters ($), (%), (/), and (+) are special characters that are used to encode all 128 ASCII characters using Code 93's Full ASCII mode.

In Code 39, four of the characters ($, %, /, and +) are used to optionally encode all 128 characters-but there is no way to know whether those characters are being used as shift characters in Full ASCII mode or whether they are being used to represent $, %, /, and +. In Code 93 this problem is solved by reserving these four special characters exclusively to "shift" into Full ASCII mode.

CODE 93 ENCODING EXAMPLE

We will now code the example we used above, TEST93, plus the two checksum digits we calculated above.

  1. The START character (*): 101011110.
  2. The digit "T": enocded as 110100110.
  3. The digit "E": enocded as 110010010.
  4. The digit "S": enocded as 110101100.
  5. The digit "T": enocded as 110100110.
  6. The digit "9": enocded as 100001010.
  7. The digit "3": enocded as 101000010.
  8. The "C" check digit "+": enocded as 101110110.
  9. The "K" check digit "6": enocded as 100100010.
  10. The STOP character (*): 101011110.
  11. Termination Bar: 1.
This is shown in the following graphical representation where the bar code has been sectioned-off into areas that reflect each of the 10 components just mentioned.

    NOTE: In the above encoding example note that the last component, the termination bar (#11), follows the last character. This is because all characters, including the STOP character, end with a space-the final termination character is used to "terminate" the last character so that the width of the final space can be determined.

EXTENDED CODE 93 ENCODING TABLE

It is possible, using Code 93's "Full ASCII Mode" to encode all 128 ASCII characters. This is accomplished by using the ($), (/), (%), and (+) symbols as "shift" characters. Those characters combined with the single character that follows indicate which Full ASCII character is to be used.

The Extended Code 93 Encoding Table is identical to the Extended Code 39 Encoding Table except that Code 93 uses its four specialized shift characters ($), (/), (%), and (+) to shift to Full ASCII mode instead of Code 39 which isues the $, /, %, and + characters.

For example, to encode a lowercase B in Code 39, the sequence "+B" is used. In Code 93 the sequence would be encoded as "(+)B" where (+) refers to one of the four special characters that Code 93 can encode that Code 39 can't.

Use the Extended Code 39 Encoding Table for Extended Code 93 encoding, and just remember to use the special characters ($), (/), (%), and (+) whenever the Code 39 Encoding table refers to $, /, %, and +.

原创粉丝点击