14.16. Data Matrix

Figure 14.3. A sample Data Matrix barcode

A sample Data Matrix barcode

Data Matrix is high density two dimensional symbology capable of encoding up to 2,000 characters of data. It used to have a group of error correction schemes from ECC00 to ECC140; now the standard mandates ECC200 to be used. Barcode ActiveX creates ECC200 Data Matrix barcodes.

14.16.1. Enhanced Feature Support

In version 3.2, several optional features are added to Barcode ActiveX:

  • Extended Channel Interpretations. This optional feature enables characters from other character sets (e.g. Arabic, Cyrillic and Greek) and other data interpretations or industry-specific requirements to be represented. This feature requires reader support.

  • FNC1 character. The FNC1 character, when appearing at the start of the symbol, indicates the data contains a specific industry format authorized by AIM. It can also appear in other positions acting as a field separator.

  • Macro Character 05 and 06. Data matrix provides a means of abbreviating an industry specific header and trailer in one symbol character.

  • Reader Programming. A reader programming character indicates that the symbol encodes a message used to program the reader system. Requires reader support.

  • Structural Append. The Structural Append feature enables encoding large amount of data using multiple symbols. Requires reader support.

14.16.2. Size Control

Data Matrix defines 30 different sizes. Most sizes are square, and a couple of them are rectangle. Regardless the final shape, the “real estate” unit, called module, is always square.

The size id, number of row and columns as well as the data capacity are listed in the table below.

Table 14.6. Data Matrix Symbol Sizes

Size ID Symbol Size Data Capacity
Enum Value Row Column Numeric Alpha-numeric Binary
mbxDMTargetSize_10X10 30 10 10 6 3 1
mbxDMTargetSize_12X12 1 12 12 10 6 3
mbxDMTargetSize_14X14 2 14 14 16 10 6
mbxDMTargetSize_16X16 3 16 16 24 16 10
mbxDMTargetSize_18X18 4 18 18 36 25 16
mbxDMTargetSize_20X20 5 20 20 44 31 20
mbxDMTargetSize_22X22 6 22 22 60 43 28
mbxDMTargetSize_24X24 7 24 24 72 52 34
mbxDMTargetSize_26X26 8 26 26 88 64 42
mbxDMTargetSize_32X32 9 32 32 124 91 60
mbxDMTargetSize_36X36 10 36 36 172 127 84
mbxDMTargetSize_40X40 11 40 40 228 169 112
mbxDMTargetSize_44X44 12 44 44 288 214 142
mbxDMTargetSize_48X48 13 48 48 348 259 172
mbxDMTargetSize_52X52 14 52 52 408 304 202
mbxDMTargetSize_64X64 15 64 64 560 418 278
mbxDMTargetSize_72X72 16 72 72 736 550 366
mbxDMTargetSize_80X80 17 80 80 912 682 454
mbxDMTargetSize_88X88 18 88 88 1152 862 574
mbxDMTargetSize_96X96 19 96 96 1392 1042 694
mbxDMTargetSize_104X104 20 104 104 1632 1222 814
mbxDMTargetSize_120X120 21 120 120 2100 1573 1048
mbxDMTargetSize_132X132 22 132 132 2608 1954 1302
mbxDMTargetSize_144X144 23 144 144 3116 2335 1556
mbxDMTargetSize_8X18 24 8 18 10 6 3
mbxDMTargetSize_8X32 25 8 32 20 13 8
mbxDMTargetSize_26X32 26 12 26 32 22 14
mbxDMTargetSize_35X44 27 12 36 44 31 20
mbxDMTargetSize_36X64 28 16 36 64 46 30
mbxDMTargetSize_16X48 29 16 48 98 72 47

In Barcode ActiveX you use DataMatrixTargetSizeID property to set the size you desire. If the property is set to 0, Barcode ActiveX picks up the size that fits the data encoded.

Previous to version 3.2, when DataMatrixTargetSizeID is too small to encode the whole data, Barcode ActiveX automatically increases the overall size. This behavior has changed in version 3.2. Now the progrom reports an error instead.

If DataMatrixTargetSizeID is more than holding the data, extra padding characters are added to the barcode. It is sometimes desirable if you want to have all the symbols created have the same size at the same time the data encoded vary from symbol to symbol.

14.16.3. Size Optimization

Internally Barcode ActiveX uses an optimized algorithm to produce the smallest symbol as possible. Usually the size is small enough. It is possible to save 1 or 2 code words when there are no pads between the data code words and the security code words. When DataMatrixTargetSizeID is set to 0, Barcode ActiveX does not attempt to perform such an optimization. You have to ask Barcode ActiveX to perform such an optimization by setting the DataMatrixTargetSizeID to the size you desire to achieve.

Consider a data matrix symbol encoded with message ~5ABCABCABCABCABCABCABCABCABCABC. When DataMarixTargetSizeID is 0, Barcode ActiveX calculates the size as 22X22 which encodes 30 data code words. The total number of data code words required are 23, just one more than the capacity of 1 20X20 symbol. In this case, if you specify the property to 20X20, Barcode ActiveX will try to take a look that it can optimize the last symbol character. Since such optimization is allowed, Barcode ActiveX creates a 20X20 barcode instead of reporting an error.

Note

The internal encodation process and “look ahead” algorithm are fairly complicated. It is difficult to deduct the most optimized size by a first glance, unless the data to be encoded has a simple nature, e.g. all digits or all capital letters.

The two barcodes below encode the same message ~5ABCABCABCABCABCABCABCABCABCABC. The left one is created under DataMarixTargetSizeID=0 (automatic). The right one is created under DataMatrixTargetSizeID=mbxDMTargetSize_20X20. Barcode ActiveX performs deep optimization when the target size is specified and creates a smaller symbol.

mbxDMTargetSizeAuto mbxDMTargetSize_20X20

The deep optimization is used in scenarios when space is a primary concern. The data needs to meet certain conditions to make it possible.

14.16.4. Module Size

The property DataMatrixModuleSize determines both the width and height of the smallest unit - a module. By default it is 20 mils. Same as all other length properties, the real value depends on Measurement.

14.16.5. Input Format

Data Matrix is capable of encoding all characters in a single-byte character set, plus some symbol-specific characters. Depending on the programming environment you may need tilde codes to escape some characters. When creating data matrix barcodes, you can use the following tilde codes:

~dnnn

When nnn corresponds to a numeric value between 0 and 255, the tilde code sequence represents a character with value equal to nnn. For example, ~d032 represents a space character.

~~

Represents a tilde (~) character.

~1

Represents a FNC1 character. The tilde escape sequence can appear anywhere in the input.

~2

Indicates that a structural append control block follows. The ~2 tilde codes format is a Morovia extension.

~3

Represents a symbol character which means that message followed is used for reader programming. This escape sequence must appear at the beginning of the input.

~5

Represents a symbol character which encodes Macro 5 abbreviation. Must appear at the beginning of the message.

~6

Represents a symbol character which encodes Macro 6 abbreviation. Must appear at the beginning of the input.

~7

Indicates the start of an ECI block. This escape sequence must be followed by exact 6 digits, which corresponds to the ECI value.

~X

Represents a character value from 0 to 26. Replace the X like in the following example ~@ means character ascii 0, ~A means character 1, ~B means character 2, ~C means character 3 ...

14.16.6.  Macro 5 and 6

Data Matrix provides a way of abbreviating two industry specific header and trailer in one symbol character. This feature exists to reduce the overall symbol size. They must appear at the beginning of the input. You can use ~5 and ~6 to escape them respectively.

Table 14.7. Macro 5 and 6

Tilde Sequence Name Interpretation
    header trailer
~5 05 Macro [)>[RS]05[GS] [RS][EOT]
~6 06 Macro [)>[RS]06[GS] [RS][EOT]

14.16.7. Extended Channel Interpretation (ECI)

ECI was introduced to allow output data stream to have different interpretations different from the default character set (ISO8859-1). Since version 3.2, Barcode ActiveX has been capable of encoding ECI values.

An ECI can be any number between 0 and 999999. The tilde code ~7nnnnnn is used to enter the ECI value. The tilde code sequence can appear at any places of the input, but there must be exact 6 digits following ~7. For example to start an interpretation of 10, enter ~7000010.

14.16.8. Structural Append (SA)

The structural append feature allows up to 16 symbols in a structure. A capable reader can either buffer the contents of each symbol until all symbols are read.

To encode structural append, you must supply there items for each symbol:

  • Symbol Sequence Indicator (SI). The sequence indicator is 1-based index which identify the position of this particular symbol in the group. Can be any number between 1 and 16.

  • Total number of symbols (TS). This value indicates the number of total symbols. Can be any number between 1 and 16. The value should be consistent among all symbols in the group.

  • File Identification Number(FID). Identify the symbol group. This number must remain the same among all the symbols in the group.

The tilde code sequence is expressed in the following format:

~2[SI][FID][TS]

For example, tilde code sequence ~1[1][126][6] indicates that the current symbol belongs to a group with file identification number as 126, and there are 6 symbols in total in this group.

The ~2 tilde code sequence must appear at the end of the input. All three fields are required and must be enclosed with square brackets ([ and ]) and must follow the tilde code ~2.

File ID (FID)

The File ID is a number remaining the constant among all symbols in a group. It uniquely identifies the symbol group. The value for this field should be between 1 and 64516.

Sequence Indicator (SI)

Sequence Indicator is the 1-based index number of the current symbol. In a group with total 10 symbols, the first symbol has the SI of 1 and the last has the SI of 10.

Total Number of Symbols

The Total Number of symbols indicates how many symbols in the group.