Whether you plan on reading, grading, training, or writing codes, you typically need to specify the code type when adding a code model to your code context using McodeModel(). If your operation is not successful, ensure that you have added a code model of the appropriate code type. Alternatively, you can automatically detect the code type of most 1D code occurrences in an image, using McodeDetect(), and then automatically add a code model for each detected code type to your code context, using McodeModel() with M_RESET_FROM_DETECTED_RESULTS. For information, see the Automatically detecting the code type section later in this chapter.
A code context can contain multiple code models of 1D code types (excluding GS1 databar, Planet, Postnet, and 4-state); for other code types, a code context can contain at most one code model. Although a code context can contain only one 2D code model, you can specify to perform a read, grade, or train operation on more than one occurrence of a Data Matrix code model (or any 1D code model that is not a GS1 Databar, Planet, Postnet, and 4-state code model), using McodeControl() with M_NUMBER.
If setting up a code context for reading codes that meet an ISO-compatible SEMI-specification, you can use a predefined code context, distributed with MIL, using McodeRestore().
This section lists the supported code types, and their MIL predefined constants. It also lists the predefined SEMI code contexts.
The following is a list of the supported 1D code types.
Code type |
Sample |
MIL constant |
McodeDetect() supported |
4-state |
|
-- |
|
BC412 |
|
Yes |
|
Codabar |
|
Yes |
|
Code 39 |
|
Yes |
|
Code 93 |
|
Yes |
|
Code 128 |
|
Yes |
|
EAN 8 |
|
Yes |
|
EAN 13 |
|
Yes |
|
EAN 14 |
|
Yes |
|
GS1-128 |
|
Yes |
|
GS1 Databar 1 |
|
-- |
|
Industrial 2 of 5 (standard 2 of 5) |
|
Yes |
|
Interleaved 2 of 5 (ITF-14) |
|
Yes |
|
Pharmacode |
|
-- |
|
Planet |
|
-- |
|
Postnet |
|
-- |
|
UPC-A |
|
Yes |
|
UPC-E |
|
Yes |
1 There are several different sub-types of the GS1 Databar code type; see the Supported encoding schemes and sub-types for the GS1 Databar code type subsection of the Supported encoding schemes, sub-types, and error correction schemes by code type section later in this chapter.
The following is a list of the supported 2D code types.
Family of code |
Code type |
Sample |
MIL constant |
Matrix |
Aztec |
|
|
Data Matrix |
|
||
Maxicode |
|
||
QR code |
|
||
Micro QR code |
|
||
Cross-row |
PDF417 |
|
|
MicroPDF417 |
|
||
Truncated PDF417 |
|
A composite code combines a 1D and 2D code together in a single image. You specify the 1D and 2D components by specifying their corresponding encoding scheme. For more information, refer to the Supported encoding scheme for composite codes subsection of the Supported encoding schemes, sub-types, and error correction schemes by code type section later in this chapter. Control types that apply to either part of a composite code also apply to the composite code as a whole. For the purposes of this chapter, composite codes will not be discussed explicitly.
The following is an example of a composite code.
Code type |
Sample |
MIL constant |
Composite code |
|
MIL is distributed with three ISO-compatible SEMI code contexts, each containing a code model and code model settings that match the specification. These can be used directly, or modified to suit your needs.
Code context file |
Specification |
Associated code type |
SEMI_T1-95r0303.mfo |
SEMI T1-95 (Reapproved 0303) |
|
SEMI_T2-0298E.mfo |
SEMI T2-0298E |
|
SEMI_T7-0303.mfo |
SEMI T7-0303 |
To use a predefined SEMI code context, restore it using McodeRestore() with the appropriate file name. These files are located in the Matrox Imaging\contexts folder. Once restored, the code context can be modified using the MIL Code module's functions.