Transcript
Bar Code Module for Matrix and Laser Printers
User Guide 61120
NOTICE All rights reserved. Reproduction of any part of this manual in any form without the permission of Image Computer Systems is forbidden. All efforts have been made to ensure the accuracy of this manual. If, however, errors are detected we would appreciate being informed. Notwithstanding this, Image Computer Systems can not be held responsible for any errors in this manual and their consequences.
© Copyright 1996 Image Computer Systems Limited
CONTENTS 1
Introduction ............................................................................................ How does it operate ........................................................................... PCE (Labelling Command Language) ............................................... PCE-CAD (Command Language Generator) .................................... Abbreviations used ............................................................................ Product support ..................................................................................
1 1 2 3 4 4
2
Installation and Set-up ........................................................................... 5 Printer Set-up ..................................................................................... 5 Bar Code Module Set-up ................................................................... 7 Laser Fonts ...................................................................................... 13 Ribbon Wear Monitor ...................................................................... 15
3
Interfaces................................................................................................ 17 Serial RS232 ..................................................................................... 17 Parallel Centronics ........................................................................... 18
4
Using the Bar Code Module ................................................................ Bar Codes ........................................................................................ Large Characters .............................................................................. Lines, Blocks and Boxes .................................................................. Label Define Mode .......................................................................... Hex Input Mode ............................................................................... Transparent Mode ............................................................................ Hex Dump Facility ..........................................................................
5
Technical Tips ....................................................................................... 49
6
Problems and Solutions ....................................................................... 53
7
Command Summary ............................................................................ 54
19 21 36 40 44 46 47 48
Chapter 1
Introduction
Introduction
1
The Image Bar Code Module adds bar code, enlarged text, line and box drawing facilities to ordinary printers. Normal use of the printer is not compromised, the features are simply extended to include the extra labelling facilities. The module is fitted to the printer, connecting between the printer and host computer. Standard printer commands can be mixed with the extra ones for labelling, giving total design freedom. The Bar Code Module works with dot matrix and laser printers. All Image Bar Code Modules and Labelling Controllers use a common PCE command language allowing easy migration from one printer to another. The Module is capable of driving any of the following printers (most printers will be compatible with one of these) :• • • •
HP LaserJet Epson FX/JX/RX/LX (9 pin) printers. Epson LQ (24 pin) printers IBM Proprinter or IBM Graphics Printer (9 pin) printers
Option set up is by means of a simple menu. Options that have been set are stored permanently in non-volatile memory. See Installation and Set-up for further details.
How does it operate ? The Module connects between the computer and printer. Normal printer commands are passed straight through, PCE commands are acted upon to produce bar codes, large text, etc. To print bar codes and large characters from existing software all you need do is precede the data with a lead-in code sequence and follow it with a terminating character. For example, a bar code of the data ABC123 could be printed from a word-processor with a sequence as simple as @ibABC123\. When the wordprocessor prints the file, a complete bar code will be produced and merged with any other text that the word-processor outputs. All the labelling facilities are dormant until activated by the lead-in code. The Module is totally transparent to normal printer operation and can be left installed, even if the labelling facilities are not being used.
1
Introduction
Chapter 1
Ordinary text can be mixed with bar codes, large characters, lines and boxes with complete freedom. The labelling commands do not cause paper movement, this is left to normal printer commands such as Line Feed etc. This means that the integrity of normal printing is not compromised and the paper will be exactly where it is expected to be after a labelling command is received. This can cause some initial confusion where users of the Bar Code Module expect a bar code command to produce the complete bar code - it will only be completed when sufficient line feeds are sent to expose the complete code.
Labelling Command Language (PCE) The command language used to access the labelling facilities is PCE (Printer Command Extension). It is designed to act as an extension to the printer's standard commands. Normal printer control codes and the extra PCE commands can be freely mixed, providing a very powerful command language. PCE commands are the same regardless of the printer type being driven. This provides compatibility between all types of printer from low cost dot matrix to high speed laser, giving great freedom of printer choice. A Command Language Generator program is provided to ease the design process.
2
Chapter 1
Introduction
PCE-CAD (Command Language Generator)
To simplify the generation of PCE commands for your application, the Bar Code Module is supplied with PCE-CAD software. PCE-CAD is a Windows program which allows you to design your label on screen and then generate a text file containing the appropriate PCE commands. The command file can then be incorporated into your own application or simply used to illustrate how to construct a label. Even if your application program runs on a Mini or Mainframe computer the ASCII file created on a PC will considerably ease the process of program development. This manual gives a complete description of the PCE language but the use of PCECAD can significantly reduce the need to study this extensively. Instructions for installing and running PCE-CAD are printed on it’s disk sleeve and it has comprehensive on-line help facility. PCE-CAD uses Label Define Mode when creating the command file - you should read the section which describes this mode for further information. Note that PCE-CAD uses “@” as an alternative lead-in character to reduce the problem of editing output files containing control codes.
3
Introduction
Chapter 1
Abbreviations used The following abbreviations and symbols are used in this manual: mm millimetres hex
Hexadecimal code
CR
Carriage Return code
LF
Line Feed code
FF
Form Feed code
ESC
The lead-in character, normally ESCAPE (ASCII 27, Hex 1B), or an alternative code selected on the option menu (see Installation and Set-up). The string terminator character normally "\", but can be an alternative character.
\
PRODUCT SUPPORT Most questions can be answered by fully reading this manual. However, if you still have a problem or question, give us a call. If your question is better explained with a sample printout, send it to us, along with a covering letter. If possible, the data or program on an IBM PC (MS-DOS) compatible floppy disk will help us to resolve any problems. Our locations are: EUROPE
Image Computer Systems Limited Ferndown Industrial Estate Wimborne, Dorset BH21 7PE England Phone: (1202) 876064 Fax: (1202) 897682
USA
Cobra Systems Inc 2555 E. Chapman Ave. Fullerton CA 92631 Phone: (714) 525-2092 Fax: (714) 525-2581
4
Chapter 2
Installation and Set-up
Installation and Set-up
2
The Bar Code Module always connects to the printer's parallel (Centronics) port via a short cable. The Velcro strips supplied may be used to affix the module to the rear of the printer. Power for the Module can be taken from the printer if it supplies +5v on pin 18 of its Centronics connector. If the printer supplies power, the red light on the Module will illuminate when the printer is on. If this does not happen, then the mains power supply will be needed. To connect the power unit, fit an appropriate mains connector to the mains input cable (brown is live, blue is neutral) and plug it into a mains socket. Plug the DC connector from the power unit (long cable with small plug at end) into the socket on the Bar Code Module. The Module will automatically power off and on with the printer, as shown by the red indicator. It will only power on when the printer is turned on with the power unit plugged into mains and the mains switched on. One end of the Bar Code Module has both a serial 25 way socket and a parallel 36 way socket. Connect your interface cable to the required socket. Data can be received from either of these sockets but not at the same time.
Printer option set-up The printer may have a number of options which are selectable, either by DIP switches or some form of menu set-up. It is important that the printer's options are set to be compatible with the Module and this should be checked before setting any Module options. Careful attention to this phase of installation will ensure trouble free operation. Typical printer options and their significance are: Print pitch The printer may allow the setting of the default, power-on print pitch. Values of 10, 12, 17 cpi will be available on dot matrix (laser defaults to Courier 10 cpi). It does not matter what pitch is set on the printer as it will be overridden by the Module's settings. Print Quality Settings such as DRAFT, NLQ etc. can be set as you require. This has no effect on the Module.
5
Installation and Set-up Emulation
Form length Interface type Interface options
Lines per inch (LPI)
National language
Perforation skip CR/LF options
Chapter 2
The printer may be capable of emulating various types of printer. The Module and the printer should be set to the same printer type. If it is a 24 pin printer then select Epson LQ as the emulation. Other emulations on a 24 pin printer are likely to compromise the quality of bar codes. The Bar Code Module, when set for Epson LQ type printers, takes advantage of the 24 pin graphics capability. For Laser printers ensure that the printer is set to emulate the HP LaserJet. This should be left as required and has no effect on the Module. Must be set to CENTRONICS parallel. The Module always connects to the printer's parallel interface. If the printer has settings for serial interface parameters such as baud rate etc. these should be ignored as these settings are now the responsibility of the Module. If the printer has an option for 7 or 8 bit data it is worth setting this to 8 bits as it sometimes affects the parallel interface (8 bits are required for transferring graphics from the Module to the printer). The Module forces 6 or 8 lpi on dot matrix and 6 lpi on laser printers to override any settings made on the printer options. Control codes sent to alter the line spacing are of course effective. This setting will be overridden by the Bar Code Module. The Module is responsible for this option so that it can produce large characters in your national language. Must be disabled. Should be set so that CR and LF are left without any special treatment. Avoid settings like CR being translated to CR/LF.
6
Chapter 2
Installation and Set-up
Bar Code Module option set-up The option set-up on the Bar Code Module is invoked by pressing both its white and black buttons at the same time. The printer will print a message as follows: BCM3000-60927 Bar Code Module (c) Image Computer Systems 1996 Current setup is :Printer
: HP LaserJet II,III,4
Baud Rate Data Bits Parity Stop Bits XON/XOFF Busy Busy Signal Level
: : : : : : :
9600 7 Even 1 Enabled Enabled -12v
National Language : Roman 8 Zeroes : Unslashed Auto LF : Lead-in character : String Terminator : Power on mode : Font threshold(mm): Font memory (KB) :
OFF ESC, HEX 1B \, HEX 5C Image 2 500
Printer Types (or compatibles) supported :[1] [2] [3] [4] [5]
IBM Proprinter Epson FX Epson LQ HP LaserJet II,III,4 HP LaserJet Plus
To change printer type.... press BLACK button indicated number of times. To move on to printer setup menu.... press WHITE button. To terminate setup procedure.... press both buttons.
The options available will depend on the printer type selected. The first thing to do is select the correct printer type being used.
7
Installation and Set-up
Chapter 2
For example to change to an Epson LQ type printer - press the BLACK button 3 times, then press the WHITE button to go to the Epson LQ specific options. The following will then be printed: BCM3000-60927 Bar Code Module (c)Image Computer Systems 1996 Menus available:[1] [2] [3] [4]
Interface Language Ribbon Monitoring General
To go to a menu.... Press BLACK button indicated number of times to select the menu, then... Press WHITE button to go to the menu Press both buttons to terminate setup procedure
Choose the category you wish to change, for example to change the Language settings: press the black button twice then the white button once to go to it. The four options of Interface, Language, Ribbon Monitoring and General are described in the following sections.
Interface The Interface menu allows setting up of the serial interface parameters. This will not be needed if the Module's parallel interface is being used and the setting can be left alone. Both parallel and serial interfaces will accept data at all times. 1 Baud Rate 2 3 4 5 6 7
: [1] [5] Data Bits : [1] Parity : [1] Stop Bits : [1] XON/XOFF : [1] Busy : [1] Busy signal level : [1]
19200, [2] 9600, [3] 4800, [4] 2400, 1200, [6] 600, [7] 300 7, [2] 8 Even, [2] Odd, [3] None 1, [2] 2 Enabled, [2] Disabled Enabled, [2] Disabled -12v, [2] +12v
To select an option.... Press WHITE button indicated number of times to reach the option, then... Press BLACK button to select the option Press both buttons to terminate setup procedure
8
Chapter 2
Installation and Set-up
Language A national language character set can be selected and will apply to both labelling characters and the printer's normal text. The selection of national language on this menu will override any settings made on the printer. The options available will vary according to the printer type selected. For an Epson LQ the following will print: Language options are:1 National Language :[1] US ASCII [2] French [3] German [4] UK [5] Danish 1, [6] Swedish, [7] Italian [8] Spanish [9] Japanese [10] Norway [11] Danish 2 [12]Spanish 2 [13] Latin America 2 Character set :[1] IBM, [2] IBM Scnd, [3] Epson 3 Zeroes :[1] Slashed, [2] Unslashed To change an option.... Press WHITE button indicated number of times to reach the option, then... Press BLACK button indicated number of times to select the required value Press both buttons to terminate setup procedure
9
Installation and Set-up
Chapter 2
Ribbon Monitoring The Bar Code Module has a facility for monitoring how much usage the printer's ribbon has had. It does this by reducing a "ribbon life count" whenever printing occurs. When the count reaches zero, and assuming that the ribbon wear feature has been enabled, an alarm sounds to warn the operator to change the ribbon. The count is then reset to its initial value by simply holding down both the black and white menu buttons. The total life value can be altered during option set-up - you may need to do this to suit a particular ribbon or printer type. 1 Ribbon wear alarm :[1]Enabled [2]Disabled 2 Life + 100,000 :[1]100K [2]200K [3]300K :[6]600K [7]700K [8]800K 3 Life + 1,000,000 :[1]1M [2]2M [3]3M :[6]6M [7]7M [8]8M 4 Life + 10,000,000 :[1]10M [2]20M [3]30M :[6]60M [7]70M [8]80M
[4]400K [5]500K [9]900K [4]4M [5]5M [9]9M [4]40M [5]50M [9]90M
To change an option.... Press WHITE button indicated number of times to reach the option, then... Press BLACK button to select the option Press both buttons to return to setup procedure
For example, to set a value of for example 24,000,000 : • Press the white 4 times and the black 2 times, to select 20,000,000. • Press the white 3 times and the black 4 times to add another 4,000,000. • The section "Ribbon Wear Monitor" explains how to decide on the value for your particular usage.
10
Chapter 2
Installation and Set-up
General (Matrix printers) General options are:1 Auto LF : [1] OFF [2] ON 2 Lead-in character : [1] ESC [2] ! [3] $ [4] % [5] ( [6] ) [7] << [8] >> [9] @ [10] [ [11] \ [12] ] [13] ^ [14] { [15] | [16] } [17] ~ 3 String Terminator : [1] ESC [2] ! [3] $ [4] % [5] ( [6] ) [7] << [8] >> [9] @ [10] [ [11] \ [12] ] [13] ^ [14] { [15] | [16] } [17] ~ 4 Power on mode : [1] Image, [2] Transparent 5 Character pitch : [1] 10 cpi [2] 12 cpi [3] 17 cpi 6 Line spacing : [1] 6 lpi [2] 8 lpi 7 Colour print : [1] Enabled [2] Disabled
Auto LF Lead in character
String terminator
Power on mode
Character pitch Line Spacing Colour print
Allows for an automatic LF when CR is received, if in doubt leave as "OFF" The normal lead-in character for a PCE command is ESCAPE (dec 27, hex 1B). This option allows an alternative to be selected. This may be necessary if the computer cannot generate the ESCAPE control code. The alternative can also be used for the printer's own ESCAPE commands (see Technical Tips for more information). Defines the terminating character of a PCE command sequence. This would normally be "\" but can be set to another code if required. By default, the module will recognise PCE commands from power on. In some cases it may be necessary to start in "Transparent" mode and enable Image PCE commands later using the "ESCiq0" command. This setting overrides the printer's default settings. This setting overrides the printer's default settings. If the printer has a colour facility, this option can be enabled to allow selection of colour in labelling commands. This option should be disabled if the printer does not have a colour facility otherwise spurious characters may print.
11
Installation and Set-up
Chapter 2
General (Laser printers) General options are:1 Auto LF : [1] OFF [2] ON 2 Lead-in character : [1] ESC [2] ! [3] $ [4] % [5] ( [6] ) [7] << [8] >> [9] @ [10] [ [11] \ [12] ] [13] ^ [14] { [15] | [16] } [17] ~ 3 String Terminator : [1] ESC [2] ! [3] $ [4] % [5] ( [6] ) [7] << [8] >> [9] @ [10] [ [11] \ [12] ] [13] ^ [14] { [15] | [16] } [17] ~ 4 Power on mode : [1] Image, [2] Transparent 5 Font threshold(mm): [1] 2 (default), [2] 5, [3] 10, [4] 15 [5] 20, [6] 25, [7] 50, [8] 100 6 Font memory (KB) : [1] 500 (default), [2] 1000, [3] 1500 [4] 2000, [5] 2500, [6] 3000, [7] 3500
General options 1 to 4 are the same as those for matrix printers. There are two additional items which relate to downloaded large character fonts. See the Laser Fonts section for further details. Font threshold(mm)
Font memory (KB)
The values listed are the available threshold heights. Below the threshold the BCM will download a “full” font giving a performance enhancement, but at the price of a longer time to printing the first page and an increase in required printer memory. Above the threshold value the BCM uses its “building brick” method for producing characters - this can sometimes reduce a printer’s performance but confers the dual advantage of speedy first page printing and requiring minimal printer memory to store the font. This option defines the maximum amount of printer memory which the BCM will attempt to use for downloading its fonts. As the font height threshold increases so does the requirement for print memory. If this value is set too low, the BCM will revert to using its building brick expansion method. See the notes below for details on setting this value.
12
Chapter 2
Installation and Set-up
Laser Fonts Normally the BCM3000 produces large characters by downloading a font containing a small number of “building brick” shapes. The large characters are constructed using suitably shaped “bricks” in a 9 by 7 matrix. This approach has two great benefits: (i) it keeps the amount of printer memory used for Image fonts to an absolute minimum; (ii) the time taken to download the “bricks” is relatively short so that the time to the first page printing is as short as possible. Smaller labelling text (2mm or less in height) is downloaded as a complete bitmapped soft font. Characters of this size are thus stored in the printer as “fully formed” and are printed in standard fashion, i.e. to print a “Q” the BCM simply sends “Q”. Some higher speed laser printers suffer a degradation in performance when printing labelling text. This occurs because the BCM must send up to 63 positioning commands per character when constructing the 9x7 matrix. To overcome this the BCM includes a user selectable threshold for the character height at which building brick expansion is used. All labelling text below this threshold height is downloaded to the printer as fully formed characters. Text above the threshold value will be constructed using the building brick method. The net result is that printing speed is not adversely affected when printing labelling text. As with all performance enhancements, there is a price to be paid. The time taken to download a fully formed font (i.e. one whose height is less than the defined threshold) can be fairly long. However, this delay occurs only the first time a page is printed - subsequent pages will be produced at maximum speed. Although using fully formed fonts can give an increase in performance it also increases the amount of memory required in the printer.
Calculating font memory The BCM uses a font of around 160 characters for producing labelling text. When using the full font printing method, each of these must be downloaded to the printer as an individual bitmapped character. The amount of printer memory required to store the font depends on the requested height and width and can be calculated as follows:-
mem = height * width * 2728 where
mem height width
is the memory required in bytes is the character height in millimetres is the character width in millimetres
13
Installation and Set-up
Chapter 2
IMPORTANT
When using fully formed fonts you should calculate the printer memory requirements then set the “Font memory” option to a value large enough to allow the fonts to be downloaded. Obviously your printer should have sufficient memory to accommodate the downloaded fonts.
For example, requesting characters with a height of 10mm and width of 8mm will require approximately 10 * 8 * 2728 = 218,240 bytes storage in the printer. Characters of height 20mm and width of 15mm will require 818,400 bytes in the printer (calculated as 20 * 15 * 2728). It is worth noting that a “building brick” font will always need much less printer memory than a fully formed one. For example, whilst the example above of a 20 by 15 mm font needs 818,400 bytes in its full font mode, it would need only around 2,900 bytes in building brick mode.
Font management During operation the BCM attempts to limit its use of printer memory to the size set by the “Font memory” option. If a request for characters of a given size would result in exceeding the font memory value then it takes one of the following actions:1. If the requested font is a fully formed one and there is enough space for a building brick one of the same dimensions, use the building brick method. 2. If there is insufficient memory for a new font and enough space can be found by deleting the least recently used font(s) then remove those fonts and load the new one. 3. If it proves impossible to create a new font then use an existing one of similar dimensions. Note that action 1 above means that if you fail to set the font memory to a value matching the space requirements of a fully formed font, the BCM will often simply use its building brick method instead. Thus it is vital that you give consideration to the setting of this value otherwise printing performance will be degraded.
Ribbon Wear Monitor 14
Chapter 2
Installation and Set-up
The option set-up allows you to enable ribbon life monitoring. This feature is useful when producing bar codes to ensure that they are always of sufficient contrast for reliable scanning. A typical value would be 24,000,000.
Setting a different ribbon life value If you wish to set the ribbon life for your particular printer type then the following procedure is suggested: • Fit the printer with a new ribbon • Invoke the Module's menu set-up, enable the ribbon life feature and set a nominal life of say 1,000,000. • Print a typical label. • Invoke menu set-up to check the ribbon life remaining. The difference between this value and the previous setting should be noted as the amount of ribbon usage per label. • Print a large number of the typical labels until the bar codes become too faint. Selectively read the bar codes from the start of the print run until the point is reached where they are difficult to read. Count the number of labels which are easy to read. Multiply this value with the ribbon usage (per label) noted earlier and you will have the total ribbon life value to set. Example: One label uses 9,208. 2,200 labels are easily scanned from the start of the batch. Therefore ribbon life should be set to 20,250,000.
15
Installation and Set-up
16
Chapter 2
Chapter 3
Interfaces
Interfaces
3
The interface to the computer can be serial RS232 or parallel Centronics. The interface from the controller to the printer is always parallel Centronics.
Serial RS232 The printer may have its own option set-up for serial interface parameters. These should be ignored and the interface setting done using the Module's menu as described in the previous chapter. The signals on the Serial interface connector are: Pin Signal 1 Frame Ground 2 Transmit Data 3 Receive Data 4 RTS 6 DSR (ignored) 7 Signal Ground 11 SSD 20 DTR (BUSY) Data flow control can be either by using a busy handshake signal or XON/XOFF.
XON/XOFF When the Module cannot receive any more characters, it transmits an XOFF character (via pin 2) to tell the computer to stop sending. When ready to receive more characters, it transmits an XON code to tell the computer to resume sending. NOTE:
If the Module has indicated that its buffer is nearly full by sending an XOFF, any data sent after that point will cause additional XOFF characters to be transmitted.
Busy handshaking When the Module can not receive any more characters, it asserts a busy signal to tell the computer to stop sending. When ready for more characters it removes the busy signal. The menu set-up allows for either positive or negative busy signal. Normally a negative signal indicates busy.
17
Interfaces
Chapter 3
By default, the busy signal is linked to pin 20 of the RS232 interface but you may also use pins 4 or 11. The module must be removed from its case to gain access to the links, which must be changed as shown below. LK1
Connects +5v to pin 18 of the Centronics input interface.
LK2
Busy pin 20 - Link 2,3,6 Busy pin 11 - Link 2,4,5 Busy pin 4 - Link 1,4,6
Parallel Centronics The interface connector has the following signals: pin signal
function
pin signal
function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
STB DATA 1 DATA 2 DATA 3 DATA 4 DATA 5 DATA 6 DATA 7 DATA 8 ACK BUSY PE SEL
Data strobe Data bit 1 Data bit 2 Data bit 3 Data bit 4 Data bit 5 Data bit 6 Data bit 7 Data bit 8 Acknowledge Busy Paper empty Printer Selected
Return Return Return Return Return Return Return Return Return
Ground Chassis +5
Signal ground Chassis ground Logic power
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
18
Ground Ground Ground Ground Ground Ground Ground Ground Ground Ground Ground Ground INIT ERROR Ground
Initialise Error
Chapter 4
Using the Bar Code Module
Using the Bar Code Module
4
Commands for bar codes and large characters have the format: [lead-in code] i [parameters] B or L [data][terminator] lead-in code
The lead-in code is shown in this manual as ESC, ESCAPE (ASCII 27, Hex 1B) but could have been set to an alternative character, using the option set-up.
i
Introduces a PCE command and distinguishes it from normal printer control codes.
parameters
The parameters are for positioning, bar code type, print style etc. If they are not specified then defaults are assumed. Spaces can be included anywhere in the parameter list and will be ignored. Parameters can be specified in any order.
B or L
Allows selection of either bar codes or large characters.
data
The data is what you want to encode as a bar code or print as large characters.
terminator
The terminator is shown in the following sections of this manual as \ but can be an alternative character, selected using the option set-up.
Bar codes, large characters, lines and boxes are all positioned relative to the current line and the left margin. If you don't specify the parameter “x” for horizontal offset, then printing will occur at the left margin, and, if you don't specify a “y" vertical offset, then printing will start at the current line. All PCE commands are stored until they need actioning. Bar codes, etc. that are defined with a "y" offset won't print until the print position reaches that offset. This allows you to define complex labels, with all label elements relative to the current print position, for example the top of a page.
19
Using the Bar Code Module
Chapter 4
IMPORTANT After issuing a bar code or any other labelling command, be sure to send enough Line Feeds to allow the complete bar code etc. to print. A bar code is normally 12mm high - three line feeds will be necessary to allow it to be completely printed. Millimetres (mm) are the default units of measurement. You can change this to other units by using the "u" (units) parameter. A change in the units of measurement does not persist beyond the current PCE command.
20
Chapter 4
Using the Bar Code Module
Bar Codes The Module takes care of producing a complete bar code and merging it with anything else that is being printed. A bar code command has the format: [lead-in code] i [parameters] B [ bar code data][terminator] example:
ESCix10t1B123456\
where:
ESCi x10 t1 B 123456 \
[lead-in code] + i = lead-in code sequence offset 10mm horizontally bar code type bar code introducer bar code data terminator character
The bar code command doesn't change the current active print position like a normal printing character or space would. The horizontal position of the bar code is determined by the value of the “x” parameter, and not by the position of the command within a line of text. Thus it does not matter whether a command is issued at the beginning or end of a line.
lead-in code sequence The lead-in code sequence for a PCE command is: ESCi (Hex: 1B 69, Decimal: 27 105) The lower case "i" is significant, ESCI will not be recognised. NOTE:
Many of the example commands in this user guide show individual parameters separated by spaces. This is done only for reasons of clarity the spaces are NOT required in practice but may be included if you wish.
21
Using the Bar Code Module
Chapter 4
Bar Code Parameters The bar code parameters are: t Type s Style p Number of passes r Human readable on/off u Units of measurement x Horizontal offset from left margin y Vertical offset from current print position h Height of bar code a Orientation of bar code (laser only) All parameters are optional. Each consists of a letter followed by a numeric value. The letters may be upper or lower case. The parameters can be in any order but they must precede the bar code data field. Spaces are allowed and can be used to make the commands more readable.
t - Type The following bar code types are available: t0 t1 t3 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20 t21 example
Code 39 (Default) Interleaved 2-of-5 Industrial 2-of-5 EAN-13, EAN-8 UPC-E Telepen Telepen Numeric Codabar MSI (Modulo 10/11 check digit) MSI (Modulo 10/10 check digit) Code 128 set A Code 128 set B Code 128 set C Code 128 auto-select Postnet FIM Code 93 Plessey (laser only) UPC-A UK Royal Mail 4-State Customer Code ESCi t1 B12345\
produces an Interleaved 2-of-5 bar code
22
Chapter 4
Using the Bar Code Module
s - Style The style parameter determines how the bar code is printed. It sets the relative widths of the thick and thin bars (the bar code ratio). Altering the style affects the overall bar code width. Together with the ”p” parameter, this allows you to fine-tune the appearance and readability of a bar code. s0 s1 s2 s3 s6 s7 s10 example:
3:1 ratio (Default) 2:1 ratio high density (available on 24 pin and laser only) 2.5:1 ratio 3:1 ratio (enlarged) 2:1 ratio (enlarged) AIAG/ODETTE Standard ESCis1t2b1234\
produces a 2:1 ratio, 2 from 5 bar code
For EAN and UPC bar codes, the style parameter is ignored - the bar code ratios are fixed except when user defined ratios are implemented. Special "user defined" bar code ratios can be established using an "su" parameter. This parameter should be used with caution and only by those who are expert in the technical aspects of bar codes. The bar code ratios already available with the standard styles have been checked over a wide range of printers using specialised verification equipment. The "su" feature can be useful in cases where a printer has an unusual dot size and it is necessary to adjust the bar code element widths to give good bar code quality. Only use this feature where you can be sure that the resultant bar codes will read reliably in all circumstances. The format for user defined styles is: sum,b1,b2,b3,b4,s1,s2,s3,s4; where
m is the unit of width selected, see the "u" parameter for units available. The unit chosen here only applies to the "su" parameter and not the whole PCE command. b1,b2,b3,b4 are the widths of the four sizes of bar elements, ranging from thinnest (b1) to thickest (b4). s1,s2,s3,s4 are the widths of the four sizes of space elements.
Four element widths are available to allow for EAN/UPC and Code 128 which are four width bar codes. Code 39, 2-of-5 etc. use only widths 1 and 3 (b1,b3,s1,s3).
23
Using the Bar Code Module
Chapter 4
example: ESCit5 su6,10,20,30,40,10,20,30,40; b123456789012?\ Produces a wide EAN bar code (u6 selects 300ths of an inch units). example:
ESCi su6,8,,24,,8,,24,; b1234\
Produces a wide Code 39 bar code. There is no need to specify the element widths that are not used in Code 39.
p - Number of Passes (9 pin dot matrix printers only) A bar code is built up from a number of strips printed underneath each other. Normally each strip is printed twice, with a small vertical paper movement between each print pass. The resulting bar codes have straighter edges, although print speed is reduced. Two pass bar codes are darker and generally higher quality. The "p" parameter allows you to select one pass printing - on dot matrix printers this produces a lower quality bar code which prints faster. One pass bar codes can sometimes be good enough to read reliably. p1 One pass (default on 24 pin printers) p2 Two pass (default on 9 pin printers)
r - Human Readable option This parameter controls the automatic printing of the encoded data below the bar code as a string of numbers and/or letters. The default is OFF, except for EAN/UPC, where the default is ON. r0 OFF r1 ON
24
Chapter 4
Using the Bar Code Module
u - Units of measurement The default units of measurement for all parameters that involve distance is millimetres. The “u" parameter allows you to select an alternative unit of measurement. u0 u1 u2 u3 u4 u5 u6 u7
millimetres (default) 1/10 inch 1/100 inch 1/12 inch 1/120 inch 1/10 mm 1/300 inch 1/720 inch (decipoints)
The "u" parameter is ONLY in effect for the current command.
x - Horizontal position The horizontal position of a bar code is always specified as the distance from the left margin to the left edge of the bar code. If the parameter is omitted, the default value is 0 and the bar code will start at the left margin. example: example:
ESCi x25 b1234\ ESCi u1 x5 5b1234\
25
Print 25 mm from left margin Print 1/2 inch (5 x 0.1") from margin
Using the Bar Code Module
Chapter 4
y - Vertical offset The top of a bar code will normally print on the current line. The "y" parameter allows you to specify a downward offset. The bar code won't start printing until the offset is reached. An upward offset is not allowed. example:
ESCi y10 b1234\
start bar code 10 mm below current line
If you specify a "y" offset then the bar code will not print until enough line feeds are sent to reach that position. The ‘‘y" parameter can be useful to predefine bar codes before the main body of text is sent. The "planted" bar code will merge with the main body of text at the position specified. Note that the following two examples will not produce the same output: Example 1: ESCiy20b1234\
ESCiy40x70bABCD\
Example 2: ESCiy20b1234\ ESCiy40x70bABCD\ A line feed exists between the two commands which moves the second bar code down by one line feed distance.
h - Height of bar code This parameter specifies the height of the bar code, excluding any human readable text below it. example:
ESCi h10 b1234\
bar code height of 10 mm
If this parameter is not specified then the following defaults are assumed: Code 39, 2-of-5, Telepen, Codabar, MSI, Code128 UPC-E EAN/UPC NOTE:
12 mm 18 mm 22 mm
The horizontal size of a bar code cannot be directly specified - it is a function of the bar code type, style and amount of data encoded.
a - Orientation of bar code Determines whether the bar code is printed in normal (gate) fashion or is rotated clockwise 90 degrees (ladder format). Only valid for laser printers. a0 a1
Normal, gate orientation (default) Rotated 90 degrees, ladder orientation
26
Chapter 4
Using the Bar Code Module
Bar Code Data The bar code data must follow any parameters that are specified. The bar code data is introduced by the character "b" (or "B"). The data to be encoded immediately follows the "b". Bar code data is terminated with a \, which also terminates the complete bar code command. example:
ESCi bABC123\
encodes “ABC123” as a barcode
A check digit can be automatically generated for bar code types which use one. To do this, simply add a "?" at the end of the data string. It is the user's responsibility to supply valid data. A command will be ignored if, for instance, you supply alphanumeric data for a numeric-only bar code such as EAN13. Valid characters for the different bar code types are:
Code 39 "0..9", "A..Z", the symbols "-.$/+%", and the Space character. A check digit will be generated if a "?" is added at the end of the data string. The Code 39 delimiters "*" are added automatically - there is no need to send them with the data. If the "*" delimiters are already included in the data string, they are not duplicated.
Code 2-of-5 (Interleaved) "0..9" numeric characters only. A check digit will be generated if a "?" is added at the end of the data string. If necessary, a leading zero is automatically inserted to make an even number of encoded characters.
Code 2-of-5 (Industrial) "0..9" numeric characters only. No check digit is available with this code.
27
Using the Bar Code Module
Chapter 4
EAN-13 13 numeric characters, or 12 numeric characters followed by "?" to generate a valid check digit. A 2 or 5 digit supplementary add-on code can be specified by including "+nn" or "+nnnnn" in the data string, where ‘n’ indicates the digits to be encoded.
EAN-8 8 numeric characters, or 7 numeric characters followed by "?" to generate a valid check digit. A 2 or 5 digit supplementary add-on code can be specified by including "+nn" or "+nnnnn" in the data string, where 'n' indicates the digits to be encoded.
UPC-A 12 numeric characters, or 11 characters plus "?" to generate a check digit. A 2 or 5 digit supplementary add-on code can be specified by including "+nn" or "+nnnnn" in the data string, where 'n' indicates the digits to encode.
UPC-E 1 to 6 numeric digits. If necessary, leading zeros are added to pad the data out to six characters. There is no automatic check digit generation using "?" since the check digit is implicit within the encoding scheme. A 2 or 5 digit supplementary add-on code can be specified by including "+nn" or "+nnnnn" in the data string, where 'n' indicates the digits to encode.
Telepen The 128 ASCII characters between ASCII 0 and 127 (Hex 00-7E). A check digit is always generated. When the human readable option is selected by "r1", characters with ASCII codes between Hex 00 and 1F will be printed as dots.
Telepen Numeric "0..9" and "X" in pairs to make up an even number of digits.
Codabar "A..D", "0..9" and the symbols "-$:/.+". You must define start and stop characters from the above set. Most applications use the letters "A...D" for this purpose. Codabar does not have a check digit - "?" in the data is invalid.
28
Chapter 4
Using the Bar Code Module
MSI "0..9" numeric characters only. "?" at the end of the data string causes a valid check digit to be generated.
Code 128 Using bar code type t15 provides for the "auto-select" version of Code128 which encodes the supplied data in the most efficient manner possible. Using this type means that you do not have to worry about which code set (A, B or C) to use for different data strings. Code sets A, B and C are individually selectable by using t12,t13 and t14 respectively. Set A encodes characters Hex 00..5F. Set B encodes characters Hex 20..7F. Set C encodes numeric pairs 00-99. Switching is allowed between the code sets by sending %A, %B, %C. FNC1, 2, 3, 4 are produced with %1, %2, %3 and %4. The SHIFT code, %S, allows temporary switching (for 1 character only) from set A to set B and vice versa. The "%" character can be encoded by sending it twice. Control characters (assuming that t12 for code set A or t15 for auto select is chosen) can be encoded by one of the following methods: %Dnnn where "nnn" is the 3 digit decimal value of the control code. %Hnn
where "nn" is the 2 digit hexadecimal value of the control code.
Note that there must be exactly 3 digits for the decimal, and 2 digits for the hexadecimal, representation. For example:, an ESCAPE character could be represented as either "%D027" or "%H1B" as shown in the following command sequences: ESCi t15 bABC%D027XYZ\ ESCi t15 bABC%H1BXYZ\
EAN128 This is Code 128 but with the first character being a FNC 1 (encoded by sending %1). The structure of the data is application dependent. Refer to the Article Numbering authority of your particular country for details of codes for your specific usage.
Code 93 "0..9", "A..Z", the symbols "-.$/+%", and the Space character. A check digit is automatically generated so there is no need to add a "?" at the end of the data string.
29
Using the Bar Code Module
Chapter 4
Postnet "0..9" numeric characters. A check digit will be generated if a “?” is added to the end of the string.
FIM Single character only "A..D".
Royal Mail 4-State Customer Code (R4SCC) This symbology is used by UK postal sorting offices to speed the delivery of mail items. The BCM3000 is certified by the Royal Mail as meeting all their dimensional and quality requirements when used with HP compatible laser printers and Epson 24 pin compatible dot matrix printers. R4SCC can encode all numeric and upper case alphabetic characters. Any lower case characters in the data string will automatically be changed to upper case by the BCM. Space characters can be included in the data string but will be stripped out and ignored when the bar code is printed. The data string can be a maximum of 25 characters. If too much data is supplied the BCM will not print the symbol. A check character is always generated for this bar code type. The height of R4SCC symbols is fixed - you cannot alter it using the “h” parameter. This ensures that all printed symbols conform with the dimensional requirements laid down by the Royal Mail. The length of the symbol varies according to the amount of data encoded. On laser printers the symbol can be printed at any of four orientations a0, a1, a2 or a3. On matrix printers the symbol can only be printed in normal “gate” orientation.
30
Chapter 4
Using the Bar Code Module
Bar Code Examples • A simple Code 39 bar code control sequence: ESCi bDATA123\
• To add a check character and switch on the Human Readable option: ESCi r1 bDATA123?\
• To place the bar code 25 mm from the left margin: ESCi r1 x25 bDATA123\
• To increase the height to 20mm: ESCi r1 h20 bDATA123\
31
Using the Bar Code Module • EAN-13, auto check digit, 5 character add-on code: ESCi t5 b501234567890?+00295\
Interleaved 2-of-5: ESCi r1 t1 b123456\
• UPC-A: ESCi t20 b1234567890?\
• UPC-E: ESCi t6 b123643\
32
Chapter 4
Chapter 4
Using the Bar Code Module
• Telepen: ESCi r1 t7 b12345678\
• Codabar: ESCi r1 t9 bA12345678A\
• MSI: ESCi r1 t11 b123456?\
Bar Code Styles The following are examples of different bar code styles. Each bar code encodes the data "123ABC". • Code 39, 3:1 ratio (style option = "s0")
33
Using the Bar Code Module
Chapter 4
• Code 39, 2:1 ratio (style option = "s1")
• Code 39, 2:1 ratio (style option = "s7", enlarged)
Sample BASIC program LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT
"XXXXXXXXXXXXXXXXXXX" "XXXX XXXX"+CHR$(27)+"ix15b123\" "XXXX XXXX" "XXXX XXXX" "XXXXXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXX"
produces: XXXXXXXXXXXXXXXXXXXXXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
34
Chapter 4
Using the Bar Code Module
Reading Bar Codes A medium resolution scanner is recommended for reading bar codes which have been produced on a dot matrix printer. A scanner with too high a resolution will be over-sensitive to the inevitable slight variation in the thickness of bars and spaces, and is liable to misread the bar codes. The ideal scanner resolution is 0.7 of the dimension of the thin element of the bar code; 9 pin printers normally have a pin size of 0.013 inch, so a wand of 0.010 inch will be suitable. Laser printed barcodes are generally of a very high quality and should not cause any reading problems. If you are printing high density barcodes then a high resolution scanner may be required. Scanners are available in both visible and infra-red forms. Visible is better for reading all types of printed code. Infra-red will often not read codes printed on an ink-jet printer, with some types of ribbon on matrix printers or on thermal printers. The ink requires a sufficient amount of carbon to work well with infra-red readers. The bar codes produced by the Bar Code Module have been tested with an RJS CodaScan verifier. The CodaScan tests four bar code characteristics: layout, encoding, print contrast and bar/space widths.
35
Using the Bar Code Module
Chapter 4
Large Characters The PCE command for producing large characters is similar to the one for bar codes and has the format: [lead-in code] i [parameters] L [text to be enlarged][terminator]
lead-in code Sequence The default lead-in code sequence is ESCi (Hex: 1B 69, Decimal: 27 105) The lower case "i" is significant, ESCI will not be recognised.
Large Character Parameters There are eight optional parameters for large characters: h w s u x y a c
Character height Character width Shading Units of measurement Horizontal position Vertical offset Axis Colour
h - Character Height This is the height of upper case letters, excluding lower case descenders. The parameter is introduced with the letter "h". h5, h22, h101 are valid examples.
w - Character Width This is the width of a single character plus the inter-character gap. The parameter is introduced with the letter "w". The range is 1-200 mm .
example:
w80
select a character width of 80 mm
NOTE:
The printed heights and widths do not always correspond exactly to the size specified. Dimensions are subject to rounding dependent on the dot density and pixel size of the printer.
s - Shading Options
36
Chapter 4
Using the Bar Code Module
The "s" is followed by a two digit number. The first digit defines the background shading - the second digit defines the foreground. 0 White 1 Black The default value is "s01" - black text on a white background. example :
s10
selects white characters on a black background
Denser black can be obtained (on dot matrix printers) by adding 100 to the shading value. example:
s110
produces white characters on a dark black background
If a background other than white is selected, the characters appear within a shaded cell. Character size as specified by the "h" and "w" parameters is unaffected, but the "x" and "y" parameters now refer to the top left hand corner of the cell.
u - Units of measurement The default unit of measurement for all parameters that involve distance is a millimetre. The "u" parameter allows you to select an alternative unit of measurement. u0 millimetres (default) u1 1/10 inch u2 1/100 inch u3 1/12 inch u4 1/120 inch u5 1/10 mm u6 1/300 inch u7 1/720 inch The "u" parameter is ONLY in effect for the PCE command in which it is contained.
37
Using the Bar Code Module
Chapter 4
x - Horizontal Position The horizontal position of a text string is always specified as the distance from the left edge of the printer. If the parameter is omitted, the default value is 0 and the text will print at the left margin. example:
x50
print text 50 mm from left margin
y - Vertical Offset The top of the text will normally print on the current line. The "y" parameter allows you to specify a downward offset. The text won't print until the offset is reached. An upward offset is not allowed. example:
y60
start text 60 mm below current line
a - Axis Text can be rotated in four orientations. The valid values are: a0 upright (default) a1 rotated 90 degrees a2 upside down, rotated 180 degrees a3 rotated 270 degrees The position of rotated text is relative to it's top left hand corner. Any "x" and "y" measurements refer to the top left corner of the text block.
c - Colour If you have a colour printer, you can select various colours for large text. The values for this parameter are: c0 black (default) c1 magenta/red c2 cyan/blue c3 violet c4 yellow c5 orange c6 green You must have a colour printer that conforms to Epson JX colour commands. You must also enable the colour option on the Module set-up menu.
Large Character Text The text to be enlarged must always follow the parameter part of the PCE command. The text is introduced by the letter "L" (or lower case "l"), and is terminated with a \, which also terminates the large character command.
38
Chapter 4
Using the Bar Code Module
A backslash "\" can be printed by including it twice in the data: "\\".
Examples of Large Character Commands • To print characters 5mm high and 2mm wide: ESCih5w2LDouble Height\
• To offset a string horizontally by 15mm from the left margin. ESCih10x15LLARGE\
• To put two separate enlarged strings on the same line and invert the second one: ESCi h5 w4 LABC\ ESCi h5 w4 a2 x15 LABC\
• Specifying shading and rotation: ESCi s10 h10 w7 LONE\ ESCi a1 s01 h12 x30 w10 LTWO\
39
Using the Bar Code Module
Chapter 4
Lines, Blocks and Boxes You can draw a line or box with a single command. As with bar codes and large characters, the shape automatically merges with standard printer text.
Line and Block Drawing One command is used to draw both lines and solid blocks. A vertical line is a tall narrow block - a horizontal line is a wide thin block. The format of the command is: [lead-in code] i [parameters] V The line/block drawing command starts with the PCE lead-in code sequence ESCi. This is followed by parameters which define the characteristics of the line or block. The command is terminated with the character "v" (or "V"). There are examples of line and block drawing later in this section.
Line and Block Parameters There are seven optional parameters: x y h w s u c
Horizontal offset from left margin Vertical offset from current print position Height of line or block Width of line or block Shading Units of measurement Colour
The parameters can be in any order, but "V" must be the last character in the command.
x - Horizontal position The horizontal position of a line or block is always specified as the distance from the left margin of the printer to the top left hand corner of the shape. If the parameter is omitted, the default value is 0 and the line or block will start at the left margin.
40
Chapter 4
Using the Bar Code Module
y - Vertical offset The "y" parameter allows you to specify a downward offset. The default value is 0. The line or block won't print until the offset is reached. An upward offset is not allowed.
h - Height of Line or Block Height of block, height of vertical line, or thickness of horizontal line. This dimension is accurate to the nearest dot. The value can range from 0.1 mm to 300mm.
w - Width of Line or Block Width of block or vertical line, or length of horizontal line. As with the "h" command, this value can range from 0.1 mm to 300 mm.
s - Shading of Line or Block The valid values for shading are: s1 Black (default) You can get darker printing (on dot matrix printers) by adding 100 to the shading value. For example, "s101" is darker than "s1".
u - Units of measurement The default unit of measurement for all parameters that involve distance is a millimetre. The "u" parameter allows you to select an alternative unit of measurement. u0 u1 u2 u3 u4 u5 u6 u7
millimetres (default) 1/10 inch 1/100 inch 1/12 inch 1/120 inch 1/10 mm 1/300 inch 1/720 inch
The "u" parameter is ONLY in effect for the current PCE command.
41
Using the Bar Code Module
Chapter 4
c - Colour If you have a colour printer, you can select various colours. The values for this parameter are: c0 c1 c2 c3 c4 c5 c6
black (default) magenta/red cyan/blue violet yellow orange green
You must have a colour printer that conforms to Epson JX colour commands. You must also enable the colour option on the Module set-up menu.
Box Drawing This command allows you to draw a box using lines of any thickness. The command is similar to the line/block drawing command above, with two differences that allow you to specify the thickness of the horizontal and vertical lines used to make up the box.
f - Vertical Thickness The "f" parameter defines the width of the vertical lines which make up the sides of the box. The default is one dot.
g - Horizontal Thickness The "g" parameter defines the thickness of the horizontal lines which form the top and bottom of the box. The default is one dot. The box drawing command is terminated by an "e" (or "E").
42
Chapter 4
Using the Bar Code Module
Examples of line, block and box drawing • One vertical and one horizontal line, starting at the same point, 10 mm in length, one mm wide ESCi h1 w10 V
ESCi w1 h10 V
• Two overlapping boxes: ESCi w30 h25 f0.2 g0.8 E ESCi x15 y10 w70 h75 f2 g5 E
43
Using the Bar Code Module
Chapter 4
Label Define Mode In certain circumstances you may want to define all the elements of a label at one point, using x and y offsets to position them. This can lead to a long line of commands which can be difficult to construct with some applications, such as word processors or database programs. PCE has two commands which make this task much simpler. ESCiq1
Stops passing commands to the printer - all data and control codes, other than PCE commands, are discarded. PCE commands are stored ready for later expansion.
ESCiq0
Restore normal operation
Label definitions should be implemented as follows: • Send ESCiq1 to disable normal operation. • Send all the PCE commands required for the label, using x and y offsets to position the bar codes, large characters etc. Because normal printer codes (including Line Feeds) will be discarded, the PCE commands can be spread over several lines - this makes your program file more readable and avoids problems with, for example, word processors breaking up long lines of text. • Use ESCiq0 to switch back to normal printing. • Now send paper movement commands (Line Feeds or a Form Feed) to print all the stored PCE elements in their defined positions. NOTE:
Normal printer text will merge automatically with the stored PCE elements.
The examples below show two different ways of producing the same label which contains 2 bar codes plus some large text. The commands are issued on the same line and use x and y offsets to achieve fine positioning. Sufficient line feeds (14 in this case) are then sent to enable the Bar Code Module to print the entire label. As can be seen, the string of commands is rather long, which makes it difficult to read and may result in it being broken into smaller parts by some applications (e.g. word processors).
44
Chapter 4
Using the Bar Code Module
example: ESCix22b2PQ47\ ESCix10y20h15w12LURGENT\ ESCix36yt1b90627\ The same commands can be sent using Label Define Mode as follows: ESCiq1 ESCix22b2PQ47\ ESCix10y20h15w12LURGENT\ ESCix36y38b90627\ ESCiq0
In this case the printer does not receive anything until after the "iq0" command. At this point simply send enough line feeds to “uncover” the label. Alternatively, a form feed will cause expansion of all stored PCE commands before the form feed is sent to the printer.
Limits The Module has approximately 7000 bytes of data storage for label elements. When using Label Define Mode, you should be aware that each element uses up part of this storage space. When the maximum capacity is reached, any further element definitions will simply be ignored. Should this prove to be a problem, split your design into a series of horizontal bands and define part of the label in each. Space (in bytes) required for label elements:Barcodes: Text: Box: Line:
Varies according to barcode type: Code39 needs 23 + number of data characters Code128 needs 24 + 2 x number of data characters 32 + number of characters 31 31
How many elements can I define? The answer depends on the mix of element types, but as an example, suppose you wish to define a label with as many 10-digit Code39 barcodes as possible. How many can be defined at once? To calculate this, simply divide the workspace size (7000 bytes) by the storage required for a single barcode, in this case 33 bytes (23 + 10 data characters) to give a total of 212 barcodes. NOTE:
This limitation only applies when driving matrix printers. There is no storage limit for laser printers.
45
Using the Bar Code Module
Chapter 4
Hex Input Mode Hex input mode can be used if your applications software is unable to send certain control characters to the Bar Code Module or printer. It allows you to send the complete range of ASCII characters between 0 and 255, using just the characters "0..9" and "A..F". To enter hex input mode, you must send two PCE lead-in characters, one immediately after the other, i.e. ESC ESC . Following the two lead-in characters, any character or control code can be sent simply by sending its ASCII code in hex. For example, the standard Escape code has the ASCII value of Hex 1B - this would be sent as "1B". Hex input mode is terminated by any character which is not "0..9" or "A..F", but Space, LF, CR or FF occurring within a hex string are ignored.
Example of Hex Input Mode Let's assume that you selected "!" (ASCII 33, Hex 21) as the alternative lead-in character when setting the controller's options. Also assume that you want to send the following PCE bar code command: !ix25r1b1234\ This can be achieved by sending the characters: !! 21 69 78 32 35 72 31 62 31 32 33 34 5C ! Note that the trailing "!" at the end of the string is used only to terminate hex input mode.
46
Chapter 4
Using the Bar Code Module
Transparent Mode The Bar Code Module monitors all commands passing through it before sending them on to the printer. It does this to ensure that it “knows” the current settings for various printer characteristics like font and national language selection. In some circumstances it may be required to disable the Module from monitoring the data stream and have it simply pass all data directly to the printer - this is known as Transparent Mode. For example, you may need this facility when driving a printer that has non-standard control codes - putting the Module into Transparent Mode prevents it from becoming “confused” by the non-standard codes. The relevant PCE commands are: ESCiq2
Transparent Mode on All subsequent data and commands sent to the Module will be passed directly to the printer. No PCE commands other than ESCiq0 will be recognised.
ESCiq0
Transparent Mode off Revert to normal operation
Note 1:
In Transparent Mode the Module performs no processing of PCE commands. Any part printed barcodes or large text will be suspended until the Module is returned to normal mode.
Note 2:
It is possible to make the Module start in Transparent mode on power up by changing the “Power on mode” to Transparent. See Installation and Set-up for more information.
47
Using the Bar Code Module
Chapter 4
Hex Dump The Module can be made to print a hex dump of all data it receives. To do this, hold down the black button while the unit is powering on until it prints the message: BCM Hex dump All data subsequently received will be printed as a list of hex characters plus the equivalent plain text. Unprintable control characters will be printed as “.” in the plain text. A running total of characters received is printed as a hexadecimal value at the start of each line:BCM Hex dump 000000 000010 000020 000030 000040 000050 000060 000070 000080 000090 0000A0 0000B0 0000C0 0000D0 0000E0 0000F0 000100 000110 000120 000130 000140 000150
1B 58 70 34 2C 36 69 61 5C 77 35 74 36 32 30 4C 78 66 69 2C 30 37
45 1B 2B 79 38 61 75 31 1B 32 36 31 2C 33 32 53 34 74 75 32 3B 35
1B 2A 33 31 2C 31 35 66 69 35 30 73 38 34 79 65 30 30 35 2C 72 36
2A 70 35 33 34 42 78 74 75 61 5C 75 2C 30 35 72 32 4C 78 34 31 30
70 33 59 34 2C 31 31 30 35 31 1B 36 31 38 39 69 79 31 35 2C 68 5C
30 30 1B 74 36 32 38 4C 78 66 69 2C 30 37 68 61 32 32 30 37 38 1B
58 59 2A 31 2C 33 32 53 31 74 75 32 3B 35 32 6C 36 33 34 2C 36 69
1B 1B 70 73 38 34 79 65 38 30 35 2C 72 36 35 20 30 34 79 38 61 75
2A 2A 30 75 2C 30 35 72 32 4C 78 34 31 30 77 4E 68 30 31 2C 31 35
70 70 58 36 31 38 39 69 79 31 32 2C 68 5C 32 6F 32 38 33 34 42 78
30 2D 1B 2C 30 37 68 61 32 32 38 37 38 1B 35 3A 35 37 34 2C 31 36
59 37 69 32 3B 35 32 6C 36 33 34 2C 36 69 61 5C 77 35 74 36 32 32
1B 31 75 2C 72 36 35 20 30 34 79 38 61 75 31 1B 32 36 31 2C 33 32
2A 59 35 34 31 30 77 4E 68 30 31 2C 31 35 66 69 35 30 73 38 34 79
70 1B 78 2C 68 5C 32 6F 32 38 33 34 42 78 74 75 61 5C 75 2C 30 35
30 2A 36 37 38 1B 35 3A 35 37 34 2C 31 34 30 35 31 1B 36 31 38 39
.E.*p0X.*p0Y.*p0 X.*p30Y.*p-71Y.* p+35Y.*p0X.iu5x6 4y134t1su6,2,4,7 ,8,4,6,8,10;r1h8 6a1B1234087560\. iu5x182y59h25w25 a1ft0LSerial No: \.iu5x182y260h25 w25a1ft0L1234087 560\.iu5x284y134 t1su6,2,4,7,8,4, 6,8,10;r1h86a1B1 234087560\.iu5x4 02y59h25w25a1ft0 LSerial No:\.iu5 x402y260h25w25a1 ft0L1234087560\. iu5x504y134t1su6 ,2,4,7,8,4,6,8,1 0;r1h86a1B123408 7560\.iu5x622y59
If you are experiencing problems driving the Module and are not sure what your computer system is actually sending to it then this facility may be useful. Should you require technical support, a hex dump of this type can prove extremely useful to the support staff.
48
Chapter 5
Technical Tips
TECHNICAL TIPS
5
Incomplete printing A common mistake for new users of the Bar Code Module is to send a bar code or large character command and wonder why it has not completely printed. Enough line feeds will need to be sent to expose the bar code. The bar code command does not itself force any paper movement.
Sending Correct Data The Bar Code Module can encode more characters than some bar code readers can decode. This is especially true of the EAN/UPC codes. It is your responsibility to supply valid data for encoding.
Non Standard Printer Commands Some printers which claim to be faithful emulations of recognised standard types have extra commands specific to themselves. Since the Bar Code Module aims to work with industry standard printers it will not support the use of such additional features. If you experience problems of this nature, consider putting the Module into Transparent Mode except where barcodes or large text is required.
Lead-in Character When an alternative lead-in character has been selected, this character effectively becomes the ESCAPE character for ALL commands, PCE or native printer. Whenever the Module encounters the alternative lead-in character it is translated into the standard ESCAPE character (27 dec, 1B hex). When choosing an alternative you should ensure that it is a character which will never normally be sent to the printer, otherwise unpredictable results may follow.
Printer Type Selection It is vital that the correct printer type is selected on the option menu set-up. For example, if you have a 24 pin Epson LQ compatible printer then the menu should be set accordingly. Choosing the wrong printer type may appear to work but since 9 pin graphics would be used to produce bar codes, the results from a 24 pin printer may well be of low quality. Please note that the Epson LQ setting allows the use of 24 pin graphics and the Bar Code Module takes account of the smaller pins of the LQ printer.
49
Technical Tips
Chapter 5
Accessing the IBM Extended Character Set Large versions of the IBM extended character set, including the national characters are built in to the Bar Code Module. There are, however, no Greek or large versions of the IBM line drawing characters. To draw lines and boxes use the PCE box drawing facility.
Carriage Returns For matrix printers only, a CR is always added when a LF is received or after any other vertical movement command.
Automatic Paper Movement Some printers provide options for automatic paper movement without being directly commanded. For example, skipping over the perforations between pages of continuous stationery. The Bar Code Module will not function correctly if such options are enabled since it has no knowledge of when the printer moves the paper.
Bar Code Quality (Matrix printers) In order to maintain the quality of bar codes, careful attention should be paid to the following points.
Ribbon wear monitor This feature ensures that bar codes are printed with good print contrast (PCS) by changing the ribbon before it becomes too faint. If the printer is unattended or used by personnel that are not aware of the importance of maintaining a good print contrast, it is advisable to enable this feature.
Print head gap The clearance between the print head and the stationery is critical. If it is too small the bar codes may be rendered unreadable by smudging. Correspondingly, if it is too large then the bar codes may be faint or contain "voids".
50
Chapter 5
Technical Tips
Print passes In general, 2-pass printing provides consistently higher quality bar codes than 1-pass. They can also extend the useful life of the ribbon by ensuring that the contrast ratio between black bars and white spaces remains higher for a longer time. Note, however, that 24 pin printers produce excellent quality bar codes in one pass because the controller takes advantage of the higher density 24 pin graphics mode. The default for 24 pin printers is 1-pass bar code printing and no advantage is gained from using 2-pass mode.
Printing on labels
Paper feed path When printing on adhesive label stock, it is advisable to keep the paper path as straight as possible. Avoid bending the stationery around a tight radius which can lead to labels peeling off and becoming stuck within the printer. Where possible it is best to use a bottom feed paper path rather than one from the rear.
Reverse paper feed (Matrix printers) Note that some printers have facilities for moving the paper in a reverse direction. This may be done to feed paper to the tear off position and then back to resume printing. This action can lead to labels being peeled off and becoming stuck inside the printer. Follow the printer manufacturer's recommendations on using labels or disable reverse feed facilities unless the printer is capable of doing so reliably.
Label stock Always use approved label stock on your laser printer. The adhesive will need to withstand the very high temperature of the fuser. Failure to use the correct materials may cause jamming. Special materials, such as polyester and vinyl are available but should be obtained from a reputable supplier.
51
Technical Tips
Chapter 5
52
Chapter 6
Problems and Solutions
Problems and Solutions
6
"I can't seem to print bar codes, large characters, etc. Only ordinary text prints" • Make sure that your command is correct and complete, check it against one of the examples in this manual. • Make sure that you set the correct lead-in and terminating codes when setting the option menu, and that these are the ones you are now sending to produce bar codes and large characters. • Remember that when you define a bar code etc. with a vertical offset, nothing will print until the paper reaches that offset. "When I send something to my printer, a lot of rubbish comes out" . • Be sure the correct printer type was selected using the option menu set-up. Ensure that a printer capable of different emulations is set to match the Bar Code Modules settings • If you have a serial interface ensure that options such as baud rate, number of bits etc. have been correctly set. "Characters are not coming out the size that I have specified" • Make sure that the printer and Bar Code Module are set to the same printer type. • The Bar Code Module produces character sizes as close as possible to those called for, within the constraints of the dot resolution of the printer. "The bar codes are not good quality" • Make sure the printer head is set with the correct gap from the paper. • Matrix - Is the ribbon still OK? Consider using the "ribbon life monitor" feature. • Laser - Has the toner run out, Is the print contrast set correctly. • Make sure that the printer and Bar Code Module are set to the same printer type.
53
COMMAND SUMMARY
Chapter 7
COMMAND SUMMARY
7
Bar Codes ESCi[parameters] B [bar code data]\ PARAMETERS
t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t20 t21 style: s0 s1 s2 s3 s6 s7 s10 print passes: p1 p2
type:
Code 39 (default) Interleaved 2-of-5 (Reserved) Industrial 2-of-5 (Reserved) EAN-13, EAN-8 UPC-E Telepen Telepen Numeric Codabar MSI (Modulo 10/11 check digit) MSI (Modulo 10/10 check digit) Code 128 set A Code 128 set B Code 128 set Code 128 auto select Postnet FIM Code 93 UPC-A UK Royal Mail 4 State Customer Code 3:1 (default) 2:1 condensed (24 pin LQ printers only) 2.5:1 3:1 (enlarged) 2:1 (enlarged) AIAG/ODETTE ratio 1 pass (default on 24 pin printers) 2 pass (default on 9 pin printers)
54
Chapter 7
r0 r1 units: u0 u1 u2 u3 u4 u5 u6 u7 position: xnnn ynnn height: hnnn orientation: a0 a1
text under:
BAR CODE DATA
data: check digit: ? add on code: +nn +nnnnn decimal code: %Dnnn hex code: %Hnn
COMMAND SUMMARY Human Readable off Human Readable on millimetres (default) 1/10 inch 1/100 inch 1/12 inch 1/120 inch 1/10 mm 1/300 inch 1/720 inch (decipoints) offset from left margin offset downward height of bar code normal, gate rotated 90° , ladder (laser only)
preceded by B (or b) Valid data depends on bar code type. Generate check digit (for t0,t1,t5, t10, t11, t16) 2 char add-on code (EAN/UPC only) 5 char add-on code (EAN/UPC only) Decimal 3 digit code (Code 128 only) Hexadecimal 2 digit code (Code128 only)
55
COMMAND SUMMARY
Chapter 7
Large Characters ESCi[parameters] L [large character text]\ PARAMETERS
shading:
sn1n2
units:
position:
size:
rotation:
colour:
u0 u1 u2 u3 u4 u5 u6 u7 xnnn ynnn hnnn wnnn a0 a1 a2 a3 c0 c1 c2 c3 c4 c5 c6
background shading n1, foreground shading n2. Values of n1,n2: 0 = White 1 = Black (add 100 for darker print on dot matrix printers) units millimetres (default) units 1/10 inch units 1/100 inch units 1/12 inch units 1/120 inch units 1/10 mm units 1/300 inch units 1/720 inch (decipoints) offset from left margin offset downward height of characters width of character upright (default) rotated 90° upside down, rotated 180° rotated 270° black magenta/red cyan/blue violet yellow orange green
LARGE CHARACTER TEXT preceded by
text:
L (or l)
Valid text includes the complete character set.
56
Chapter 7
COMMAND SUMMARY
Line, Block and Box Drawing Lines and blocks:
ESCi [parameters] V
Box Drawing:
ESCi [parameters] E
PARAMETERS
shading:
sn
units:
position:
size:
u0 u1 u2 u3 u4 u5 u6 u7 xnnn ynnn hnnn wnnn
where n is the shading value: 1 = Black (add 100 for darker print) millimetres (default) 1/10 inch 1/100 inch 1/12 inch 1/120 inch 1/10 mm 1/300 inch 1/720 inch (decipoints) offset from left margin offset downward height of vertical line/block or thickness of horizontal line/block. length of horizontal line/block or width of vertical line/block. black magenta/red cyan/blue violet yellow orange green
colour:
For boxes, the following parameters are added: thickness: fnnn width of the vertical box sides gnnn thickness of the horizontal box sides
c0 c1 c2 c3 c4 c5 c6
The line and box drawing commands are terminated by the letters V and E. No other termination is needed.
57
COMMAND SUMMARY
Chapter 7
Label Define Mode ESCiq1
Disable printer codes, allow PCE command definitions only
ESCiq0
Enable printer codes
Hex Input Mode ESC ESC [hex data][terminator] hex data:
character pairs "00..FF" (space, LF, CR, FF ignored)
terminator: any character not "0..9", "A..F", space, LF, CR or FF.
Transparent Mode ESCiq2
Transparent Mode on (disables PCE command processing)
ESCiq0
Transparent Mode off (revert to normal operation)
58
Index
2 2-of-5 bar codes .......................................................................................................... 27
A Abbreviations................................................................................................................ 4 Automatic paper movement........................................................................................ 50 Axis for large text ....................................................................................................... 38
B Bar code - human readable data.................................................................................. 24 Bar code check digits............................................................................................ 27, 31 Bar code command ..................................................................................................... 21 Bar code data .............................................................................................................. 27 Bar code height ........................................................................................................... 26 Bar code parameters.................................................................................................... 22 Bar code print quality (matrix printers) ...................................................................... 50 Bar code print style selection................................................................................ 23, 33 Bar code ratios ...................................................................................................... 23, 33 Bar code readers ......................................................................................................... 35 Bar code type selection ............................................................................................... 22 Bar codes .................................................................................................................... 21 Box drawing................................................................................................................ 42 Boxes .......................................................................................................................... 40 Boxes - side thickness................................................................................................. 42 Busy handshake flow control...................................................................................... 17
C Calculating font memory ............................................................................................ 13 Centronics interface ...................................................................................................... 5 Character height.......................................................................................................... 36 Character pitch (CPI) .................................................................................................. 11 Character shading ....................................................................................................... 37 Character width........................................................................................................... 36 Check digit for bar codes ...................................................................................... 27, 31 Codabar bar codes....................................................................................................... 28 Code 128 bar codes..................................................................................................... 29 Code 39 barcodes........................................................................................................ 27 Code 93 bar codes....................................................................................................... 29 Colour print enable ..................................................................................................... 11 Colour printing............................................................................................................ 38
59
Index Command language generator .......................................................................................3 Command summary.....................................................................................................54 Commands - barcode and large text ............................................................................19 Correct data .................................................................................................................49
D Data for bar codes........................................................................................................27 Defining a label format................................................................................................44 Defining your own bar code styles ..............................................................................23 Drawing lines ..............................................................................................................40
E EAN128 bar codes.......................................................................................................29 EAN-13 bar codes .......................................................................................................28 EAN-8 bar codes .........................................................................................................28
F FIM bar codes..............................................................................................................30 Flow control (serial interface) .....................................................................................17 Font management ........................................................................................................14 Font memory ...............................................................................................................12 Calculating .............................................................................................................13 Font threshold..............................................................................................................12 Fonts Building brick ........................................................................................................13 Fully formed...........................................................................................................13
H Height of barcode ........................................................................................................26 Height of large characters............................................................................................36 Hex dump facility ........................................................................................................48 Hex input mode ...........................................................................................................46 Horizontal positioning .....................................................................................19, 25, 38 Human readable barcode data......................................................................................24
I Incomplete printing .....................................................................................................49 Installation and Set-up...................................................................................................5 Interface type .................................................................................................................6 Interfaces .....................................................................................................................17 Interleaved 2-of-5 bar codes........................................................................................27 Inverse printing............................................................................................................37
60
Index L Label Define mode...................................................................................................... 44 Label printing guidelines ............................................................................................ 51 Large character colour ................................................................................................ 38 Large character data.................................................................................................... 38 Large characters.......................................................................................................... 36 Large text orientation.................................................................................................. 38 Laser Fonts.................................................................................................................. 13 Lead-in character ........................................................................................................ 49 Lead-in character selection ......................................................................................... 11 Lead-in code ........................................................................................................... 1, 19 Line drawing............................................................................................................... 40 Line spacing (LPI) .................................................................................................. 6, 11
M Measurement units.......................................................................................... 20, 25, 37 MSI bar codes ............................................................................................................. 29
N National language ..................................................................................................... 6, 9 Non standard printer commands ................................................................................. 49
O Option set-up ................................................................................................................ 7 Orientation of large text.............................................................................................. 38
P Parallel interface ......................................................................................................... 18 PCE command summary............................................................................................. 54 PCE commands............................................................................................................. 2 Positioning .................................................................................................................. 19 Postnet bar codes ........................................................................................................ 30 Power on mode ........................................................................................................... 11 Power supply ................................................................................................................ 5 Print pass selection (matrix printers) .......................................................................... 24 Print pitch (CPI)............................................................................................................ 5 Printer connection ......................................................................................................... 5 Printer option set-up ..................................................................................................... 5 Printer type selection .............................................................................................. 6, 49 Printer types supported ................................................................................................. 1 Problems and solutions ............................................................................................... 53
61
Index R Reading bar codes........................................................................................................35 Ribbon wear monitor (matrix printer) ...................................................................10, 15 Royal Mail barcodes....................................................................................................30
S Sample BASIC program..............................................................................................34 Scanning bar codes ......................................................................................................35 Serial interface.............................................................................................................17 Serial interface set up ....................................................................................................8
T Technical tips...............................................................................................................49 Telepen bar codes ........................................................................................................28 Terminator .....................................................................................................................1 Terminator character selection ....................................................................................11 Text under bar codes ...................................................................................................24 Transparent mode ..................................................................................................11, 47
U Units of measurement............................................................................................25, 37 UPC-A bar codes.........................................................................................................28 UPC-E bar codes .........................................................................................................28 User-defined barcode styles (ratios) ............................................................................23
V Vertical positioning .........................................................................................19, 26, 38
W Width of large characters.............................................................................................36
X X co-ordinate ...................................................................................................19, 25, 38 XON/XOFF flow control ............................................................................................17
Y Y co-ordinate ...................................................................................................19, 26, 38
62
Index
63