DMP 2200 (260-1279) Control Codes Faxback Doc. # 4553 The DMP-2200 is designed for three applications: * Data processing * Word processing * Graphics printing The Printer responds to software codes from the computer in three different ways--one for each application. The three response patterns, or modes, have many similarities, but each has its own unique features. Data and word processing modes are used for printing characters. The only difference between these two modes is the way they handle line feed commands (commands that decide which direction and how far the paper is fed). * In the word processing mode, each line feed command causes immediate paper advancement. Word processing programs (such as SCRIPSIT) can use immediate line feeds for superscripts, subscripts, and the like. * In the data processing mode, line feed commands do not cause immediate printing. Instead, they are stored in the Printer's memory along with the other data. When the current line is printed, the line feed commands stored in memory determine the direction and pitch of the paper feed. Both data and word processing modes can print in different printer font styles and in different pitches (character spacing). One font style is the proportional character set and the other is the monospaced character set. * Proportionally spaced characters have variable widths; for instance, and M takes up more space than an I. Proportional characters are used to create professional-looking documents. * Monospaced characters are so named because each character takes up the same width. This uniformity makes it preferable to tables and charts that require vertical alignment. The font styles are determined by the dot-matrix pattern. Monospaced characters use a 9 x 8 and 17 x 18 matrix, while proportionally spaced characters use an n x 18 matrix. The print pitch (character spacing) is determined by the space the DMP-220 puts between each printed character and also by the font style. Consequently, you must think of pitch in terms of the number of characters printed per inch--10 CPI, 12 CPI, and 17.1 CPI. CPI for standard printing and 5 CPI, 6 CPI, and 8.6 CPI for elongated printing. In graphics mode, you have complete control of the print head. This mode can be used to create a custom letterhead, designs, special type fonts, etc. However, with graphic operation, many control codes (which can be used with data and word processing) can not be used. The DMP-2200 doesn't return an error when you send such a code--it simply ignores the code. This includes codes that change line feed pitch and direction. Graphics mode uses 7/72" forward line feed to ensure full coverage of the paper, and also 1/72", 1/144", and n/144" forward line feeds. CONTROL CODES Before investigating the various print modes, consider how the computer communicates with your Printer. All information is sent to the Printer as numbers between 0 and 255 decimal (00-FF hexadecimal). The Printer interprets these numbers according to the American Standard Code for Information Interchange, commonly referred to as the ASCII code. (See Appendix C for a list of ASCII codes.) Most numbers (or codes) are printed as letters, numbers, or symbols. However, the numbers 0-31, as well as some special sequences of code numbers, are used to control various functions of the Printer. These control codes allow you to change character sets, select print modes, underline, superscript, subscript, italicize, etc. The control codes have different meanings, depending on the current print mode. If a code is not recognized by the Printer, it is printed as X. The next few sections demonstrate how some of the control codes activate vari- ous Printer functions. Read these sections carefully. SENDING CONTROL CODES FROM BASIC Tandy codes are discussed in this section (DIP switch A-1 set to OFF). For IBM codes, refer to chapter 8, IBM EMULATION MODE. Some Printer features are activated by a single code, but many functions require a sequence of two or more codes. Most multiple code sequences begin with decimal 27 (referred to as the ESCape code). The ESC code notifies the Printer that a special sequence is on its way. The next code(s) sent determines which Printer feature is selected. In BASIC, use CHR$( ) to send these codes to the Printer. For instance, set up the DMP-2200 as described earlier and enter BASIC in the normal way, Then type the following program: 10 REM 20 LPRINT"DATA";CHR$(28);PROCESSING 30 LPRINT"MODE" and RUN it. Roll the paper forward and look at the results. The word MODE printed over part of DATA. Why? The codes CHR$(27) and CHR$(28) are the guilty parties. Take a quick look at Appendix A. This chart shows the various code sequen- ces understood by the DMP-2200. The control code sequence CHR$(27);CHR$(28) means change the forward line feed to half its normal distance. DATA PROCESSING MODE How can you tell which mode the DMP-2200 uses when it's first turned on? A little reflection on the above program tells you all you need to know. Line feed commands are executed immediately in word processing (WP) mode, but not in data processing (DP) mode. The (27 28) sequence didn't cause a half forward line feed until after the first line was printed. Thus, the Printer must be in DP mode. And, in case you missed it, this new line feed stays in effect until further notice (another characteristic of DP mode). Type: LLIST Sure enough. You still have that short line feed. Type LPRINT CHR$(54) to return to normal line feed pitch. WORD PROCESSING MODE If the same program were executed in WP mode, the line feed would have occurred immediately after the word DATA. Go into WP mode and try it. To enter the WP mode, change line 10 to: 10 LPRINT CHR$(20):REM CHR$(20) SELECTS WP MODE and RUN the program. Just as you suspected, the line feed is immediately executed. Note that in WP mode, the new line feed is only temporary. Type LLIST to prove that the half forward line feed doesn't occur. GRAPHICS MODE Graphics mode is very different from the other two printing modes. For one thing, graphics mode accepts a line feed code (CHR$(10) which is fixed at 7/72, and also 1/72", 1/144", and n/144" forward line feed codes. Furthermore, only a few of the WP and DP features are available in graphics mode. Standard letters and symbols, for example, are ignored by the Printer when it is in graphics mode. Standard letters and symbols, for example, are ignored by the Printer when it is in graphics mode. Instead, numeric data from 128 to 255 is translated into dot patterns for the print head. This lets you produce high-resolution, graphic printouts of charts, logos, etc. For a quick look at this mode in action, change our test program to: 10 LPRINT CHR$ (18) 20 FOR I=128 TO 255 30 LPRINT CHR$(I); 40 NEXT and RUN the program. CHR$(18) puts the DMP-2200 into graphics mode. The numbers 128 through 255 are interpreted as dot patterns. Type LPRINT CHR$(30) to return the Printer to WP mode. Try LPRINTing the program to be sure you're not stuck in graphics land. SELECTING A PRINT MODE Table 6 summarizes control codes required to move from one mode to another. TABLE 6. CONTROL CODES FOR CHANGING MODES ┌─────────────────┬──────────────────┬───────────────────────┐ │ IF YOU'RE IN: │ AND WANT TO │ SEND A CHR$( ): │ │ │ CHANGE TO: │ (DEC) (HEX) │ ├─────────────────┼──────────────────┼───────────┬───────────┤ │ DP │ WP │ 20 │ 14 │ │ │ GRAPHICS │ 18 │ 12 │ │ │ │ │ │ │ WP │ DP │ 19 │ 13 │ │ │ GRAPHICS │ 18 │ 12 │ │ │ │ │ │ │ GRAPHICS │ DP │ 30* │ 1E │ │ │ WP │ 30* │ 1E │ └─────────────────┴──────────────────┴───────────┴───────────┘ * Returns to the last mode (WP or DP) used. HINTS AND TIPS ABOUT PRINT MODES: DATA PROCESSING MODE * All commands which determine line feed pitch and the direction of move- ment are stored in the Printer's memory. They are not executed until a LF code (10 Dec.) is received. Then, the paper advances according to the pitch and direction codes stored in the Printer's memory. * Line feed commands stay in effect until replaced by a new command. * All printable characters (except user-defined graphics) can be printed in this mode. WORD PROCESSING MODE * Line feed codes that determine pitch or direction are executed immediate- ly. * Line feed pitch and direction changes affect only the current print line. * All printable characters (except user-defined graphics) can be printed in this mode. GRAPHICS MODE * This mode is very different from the other two modes. In graphics mode, a line feed code (10 Dec.) causes the paper to move 7/72" forward. Forward line feed codes of 1/9", 1/48", 1/72", 1/144", and n/144" are also available. Reverse direction is not allowed. * Decimal numbers 128-255 sent via CHR$ in BASIC are interpreted as pin firing patterns for the print head. * Only a few code sequences are recognized in graphics mode. CONTROL CODE SUMMARY A TANDY CONTROL CODES ┌───────────┬────────────┬──────────────┬──────────────────────────┬──┬──┬──┐ │CODE HEX │CODE DEC │SYMBOL │OPERATION │DP│WP│BI│ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │00 │00 │NUL │Ignored │X │X │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │01 │01 │SOH │Ignored │X │X │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │07 │07 │BEL │Sounds the Buzzer │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │08+n │08+n │BS+n │Back Space │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │0A │10 │LF │Line Feed │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │0C │12 │FF │Form Feed │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │0D │13 │CR │Carriage Return │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │0E │14 │SO │End Underline │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │0F │15 │SI │Start Underline │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │12 │18 │DC2 │Select BI Mode │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │13 │19 │DC3 │Select DP Mode │X │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │14 │20 │DC4 │Select WP Mode │O │X │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+O1-09 │27+01-09 │ESC+n │Proportional Spacing │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+0A │27+10 │ESC+LF │Full Reverse LF │* │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+0E │27+14 │ESC+SO │Start Elongation │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+0F │27+15 │ESC+SI │End Elongation │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+10+n1+n2│27+16+n1+n2 │ESC+POS+n1+n2 │Positioning │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+11 │27+17 │ESC+DC1 │Select Proport.Character │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+12 │27+18 │ESC+DC2 │Select Corresp.Cha.10 CPI │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+13 │27+19 │ESC+DC3 │Select Standard Cha.10 CPI│O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+14 │27+20 │ESC+DC4 │Select Standard Cha.17 CPI│O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+15 │27+21 │ESC+NAK │Select CR=CR only │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+16 │27+22 │ESC+SYN │Select CR=NL │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+17 │27+23 │ESC+ETB │Select Standard Cha.12 CPI│O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+1A │27+26 │ESC+SUB │1/48" Forward LF │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+1C │27+28 │ESC+FS │Half Forward LF │* │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+1D │27+29 │ESC+GS │Select Corresp.Cha. 12 CPI│O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+1E │27+30 │ESC+RS │Half Reverse LF │* │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+1F │27+31 │ESC+US │Select Bold Character │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+20 │27+32 │ESC+SP │End Bold Character │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+21 │27+33 │ESC+! │Select IBM Mode │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+2F │27+47 │ESC+/ │Select Proport.Cha.(Comp) │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+32 │27+50 │ESC+2 │1/72" Forward LF │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+34+n │27+52+n │ESC+4+n │Set Form Length │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+36 │27+54 │ESC+6 │Full Forward LF │* │X │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+38 │27+56 │ESC+8 │Three-quarter Forward LF │* │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+39 │27+57 │ESC+9 │1/144" Forward LF │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+3A │27+58 │ESC+: │Select IBM Character Set │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+3B │27+59 │ESC+; │Select TANDY Character Set│O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+40+n │27+64+n │ESC+!+n │n/144" Forward LF │* │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+42+n │27+66+n │ESC+B+N │Italic On/Off for n=1,0 │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+47 │27+71 │ESC+G │1/9" Forward LF │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+48n │27+72+n │ESC+H+n │Set Perforation Skip │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+49+n1+n2│27+73+n1+n2 │ESC+I+n1+n2 │Select High Res. Bit Image│O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+4D │27+77 │ESC+M │Select Micro Font │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+51+n │27+81+n │ESC+Q+n │Set Left Margin │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+52+n │27+82+n │ESC+R+n │Set Right Margin │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+53+n │27+83+n │ESC+S+n │Sup/Subscript for n=0,1 │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+55+n │27+85+n │ESC+U+n │Bi/Unidirection for n=0,1 │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+57 │27+87 │ESC+W │Select Double Height Char.│O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+58 │27+88 │ESC+X │End Sup/Sub │O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1B+59 │27+89 │ESC+Yn │Select Int'l Character Set│O │O │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1C+n1+n2 │28+n1+n2 │FS+n1+n2 │Repeat Data │O │O │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │1E │30 │RS │End BI Mode │X │X │O │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │7F │127 │DEL │Ignored │X │X │X │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │FF │255 │ │Undefined Code │X │X │D │ ├───────────┼────────────┼──────────────┼──────────────────────────┼──┼──┼──┤ │Other 02-1F│Other 02-31 │ │Undefined Code │? │? │X │ ├───────────┼────────────┴┬─────────────┼──────────────────────────┼──┼──┼──┤ │Codes 80-9F│Codes 128-159│ │Undefined Code │? │? │D │ └───────────┴─────────────┴─────────────┴──────────────────────────┴──┴──┴──┘ (dtc-07/26/93)