EPSON EPSON AMERICA INC. Product Support Bulletin Subject: Understanding and Using ESCP/2 Commands and Syntax PSB No: P-0082 Originator: JW Date: 12/4/91 Page(s): 1 of 14 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. Command Command Name ESC X m n1 n2 ESC ( C m1 m2 n1 n1 ESC(vm1 m2 n1 n2 ESC(Vm1 m2 n1 n2 ESCtn ESC ( t n1 n2 d1 d2 d3 ESC( ^ n1 n2 d1...
PSB No: P-0082 Page: 2 of 14 ESC X m n1 n2 (Select Pitch and Point Size) 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.
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” 50 LPRINT CHR$(27);“(v”;CHR$(2);CHR$(C);CHR$(C);CHR$(0) 60 GOTO 10 70 DATA 0,16,20,21,24,28,32,36,40,42,44,48,52,56,60,64 Line 10 - allows you to specify the point size desired.
PSB No: P-0082 Page: 4 of 14 These are 8 point characters These are 10 point characters These are 10.
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.
PSB No: P-0082 Page: 6 of 14 1 ESC ( v m1 m2 n1 n2 (Set Relative Vertical Position ESC (v m1 m2 n1 n2 is the command for advancing the print position vertically in units where m1, 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 ml 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 vertical motion distance in inches.
PSB No: P-0082 Page: 7 of 14 EXAMPLE 1. 2. 3. 4. 5. 6. The desired distance is 1/4 inch. 1/4 x 360 = 90 90 divided by 256 = 0 with a remainder of 90. 256-90=166 n1=166 n2=255 In the Basic programming language, the command would look like this. LPRlNT CHR$(27);“(v”;CHR$(2);CHR$(0);CHR$(166);CHR$(255) This command, as listed in the line above, will feed the reverse feed the paper 1/4 inch from the current line. The current print column (horizontal position) IS NOT changed.
PSB No: P-0082 Page: 8 of 14 C (V m1 m2 n1 n2 is the command for changing the print position vertically (with respect to the Top of Form position) in units where m1, 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 vertical distance from the Top of Form in inches.
PSB No: P-0082 Page: 9 of 14 ESC t n is the command for selecting a character table to be used for printing where n is a variable. The following table lists the values for n and the character table associated with the value. I n I I 3 I PC437 (US) T a b l e II II Table 1 NOTE: 1. Character tables other than those listed above can be assigned by using the ESC ( t command (Assign Character Table). 2 The value used for n can be either the ASCII value OR the ASCII character (i.e. chr$(1) or “1”).
PSB No: P-0082 Page: 10 of 14 ESC ( t n1 n2 d1 d2 d3 (Assign Character Table) ESC (t n1 n2 d1 d2 d3 is the command for assigning character tables where n1, n2, d1,d2, and d3 are variables. Currently, variables, n1, n2 and d3 MUST be n1=3, n2=0, and d3=0. Variable d1 is a number corresponding to one of the four tables selectable with the ESC t n command. This is the table that will be replaced. Valid values for d1 are 0,1,2, and 3 (see Table 1 below).
PSB No: P-0082 Page: 11 of 14 page contains a print sample of the Registered Tables available in printers sold in the U.S. In order to print the first 31 characters in Tables 1 through 9, the ESC ( ^ command must be sent. Listed below is a Basic language program and an explanation of the program that will print the output illustrated on page 13 of this bulletin.
PSB No: P-0082 Page: 12 of 14 60 If the Registered Character Table number is not 0, print ASCII values 1 through 255 inclusive. Remember, line 70 allows the first 31 ASCII values to print as characters, not control codes. 90 If the Registered Character Table number is not 0, do not execute commands in lines 100 and 110. 100 If this Registered Character Table number is 0, sand ASCII values 33 through 126 to the printer.
PSB No: P-0082 Page: 13 of 14 Table 0 I t a l i c ‘#$X& ()*+,- ./0123456789:;c=>?~ABCDEFGHIJKLMNOPQRSTU~YZ~\~n-fabcdefghijklm >pqrstuvwxyz( :}‘!“#$X&‘()*+,-./0123456789:; e=> ?BABCDEFGHI JKLMNOPQRSTUVRXYZ[ \ J ^, nbcdefghijklmnopqrstuvwxyz{,‘}- Table 8 PC863 (Canada-French) D~,+~*~o~~~pRU.4:!!~[g,~tl~t~oA !“#$%C’()*+,-./Or23456789 :;<=*?@ABCDEFGHIJKLMNOP XSTUWXYZ[\]--’ a b c d e f g h i j k l m n o ~rstuvwxyz{I)~~~b~Alt~EBbii~~E~E~~X~iiO~6U~fbOf~‘66”.3-f~~~~~a:.
PSB No: P-0082 Page: 14 of 14 C ( ^ n1 n2 d1,.. dk is the command for printing control codes as data where n1 and n2 are variables and d1...dk represent the data that is to be printed as characters. The variables n1 and n2 tell the printer "the next xx ASCII codes are to be interpreted as characters instead of control codes”.