This bulletin provides detailed explanations and illustrations for some of the more
commonly used printer commands used in ESC/P2 Listed below are the
commands discussed in this bulletin.
Set Page Length in Defined Units
Set Relative Vertical Position
Set Absolute Vertical Position
Select Character Table
Assign Character Table
Print Data as Characters
2
ESCP/2
Commands and Syntax
PSB No: P-0082
Originator: JW
PSB Page
2
5
6
8
9
10
14
PSB No: P-0082
Page: 2 of 14
ESC X m n1 n2
C X m n1 n2 is the command for selecting pitch and point size where m, n1 and
n2 are variables. The variable "m" is used to select the pitch which is the character
spacing. The variable "n1" selects the point size and the variable “n2”, at this time,
will always be 0 (zero). The variables "m" and "n1" are explained below.
The values used for ’m’ are 0,1,18,21,24,30,36,42,48,60, and 72. If "0" is
used as the value for ”m”, there will be no change in pitch. If "1" is used as the
value for "m", the character pitch will be proportional spacing. To determine the
character pitch for all other values of "m", divide 360 by "m".
then 360 divided by 60 equals 6 and the character pitch is 6 characters per inch. If
m=30, the character pitch is 12 characters per inch.
For the Roman and Sans Serif fonts, the values used for "n1" are 0,16,20,21,24,
28,32,36,40,42,44,48,52,56,60 and 84. For all other fonts, the values used for
"n1" are 0,21, and 42. The actual point size that will print is n1 divided by 2. For
example, if n1=20, the point size is 10. If n1=48, the point size is 24.
When selecting a point size larger than 24 (the value for n1 is greater than 48)
select proportional spacing (m=1) for the character pitch.
(Select Pitch and Point Size)
For example, if m=60
NOTE:
In the Basic programming language, the command would look like this.
LPRlNT CHR$(27);"X";CHR$(1);CHR$(48);CHR$(0);”This is 24 point proportional
spaced”
Chr$(27) is ESC, chr$(1) selects proportional spacing, chr$(48) selects 24 point
character size. At this time, n2 is always zero (0).
PSB No: P-0082
Page: 3 of 14
10 INPUT “Point Size”;A$
20
B=VAL(A$)*2
21
RESTORE 70
22 FOR X=1 TO 16
23 READY
24
IF B=Y THEN GOTO 30
25 NEXT X
26 CLS
27 PRINT A$ ” is not a valid point size choice.”
20 GOTO 10
30 C=VAL(A$)
40 LPRINT CHR$(27);“X”;CHR$(1);CHR$(B);CHR$(0);”These are “;A$;” point
characters”
GOTO 10
70 DATA 0,16,20,21,24,28,32,36,40,42,44,48,52,56,60,64
Line 10 Line 20 tine 21 -
Line 30 - computes the value for “n1” for advancing paper using the ESC ( v
Line 40 -
Line 50 -
Line 60
NOTE: To halt the program, hold down the “Ctrl” key and press the “C” key.
allows you to specify the point size desired.
computes the value for “n1” in the ESC X command.
check to ensure that a valid point size was input
valid, the program jumps to line 30.
program prints a message on the screen and starts over again.
command.
sends the “Set Pitch and Point Size” command to the printer. (Note: The
pitch is set for proportional spacing for all point sizes to ensure proper
character spacing regardless of the point size.)
sends the “Set Relative Vertical Position” command to the printer. This
command advances the paper in preparation for printing the next line.
causes the program to start again at the beginning.
If the point size is not valid, the
If the point size is
These are 8 point characters
These are 10 point characters
These are 10.5 point characters
These are 12 point characters
These are 14 point characters
These are 16 point characters
PSB No: P-0082
Page: 4 of 14
These
These
are 18 point characters
are 20 point characters
These are 21 point characters
These are 22 point characters
These are 24 point characters
These are 26 point characters
These are 28 point characters
These are 30 point characters
These are 32 point characters
PSB No: P-0082
Page: 5 of 14
ESC ( C m1 m2 n1 n2 (Set Page Length in Defined Units
ESC ( C m1 m2 n1 n2 is the command for setting the page length in units where ml,
m2, n1 and n2 are variables. The “unit’ is usually 1/360 of an inch unless defined
otherwise by the “ESC ( U" command. Currently, the values for m1 and m2 MUST be
m1=2 and m2=0.
To determine the values for n1 and n2 perform the following steps.
1.
Determine the desired page length in inches.
2
Multiply the page length by 360.
Divide the result by 256 using long division.
3.
4.
The remainder in the quotient from step 3 is the value for n1.
The whole number in the quotient from step 3 is the value for n2.
5.
EXAMPLE
1.
The page length is 8.5
2
8.5 x 360 = 3060
3.
3060 divided by 256 =
4.
n1=244
5.
n2=11
inches.
11 with
a
remainder of 244.
II
In the Basic programming language, the command would look like this.
This command, as listed in the line above, will set the page length to 8.5 inches.
NOTE: The current line becomes the top of form. This command cancels any
previously set top and bottom margin settings. If you wish to set the top and bottom
margins via software command, the commands must be issued AFTER the “Set Page
Length in Defined Units” command. The proper page length setting can be confirmed
by issuing a “Form Feed” command, chr$(12), or by pressing the “FF button on the
control panel while the printer is “Off Line”.
Loading...
+ 9 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.