Appendix F: Application Programming Tips. Black Box A/C-6
Tangazo
Tangazo
A/C-6 (RO)
Appendix F: Application Programming
Tips
Some printers support such advanced features as downloading and selecting soft fonts, printing raster graphics, and changing between portrait and landscape page orientation. Accessing these advanced features requires the use of escape sequences and some require the use of binary values. Because of IBM system constraints, many of the codes required cannot be sent directly from a host. This chapter presents some of the methods to assist in transmitting ASCII data through the IBM system in a form usable to the printer.
All of the configuration options referred to in this chapter can be input at a host workstation, at a serial connected PC, or on A/C-6 (RO)’s front panel.
F.1 IBM System Considerations
Print data transmission through an IBM system is restricted to the EBCDIC code set defined by IBM. Host editors and print spooling programs restrict print data to the codes and usage defined by IBM. Remote telecommunication protocols also restrict code transmission. For these reasons, some of the codes needed to control the printer cannot be sent using normal methods. The escape character used in all escape commands is one of the codes that has no printable equivalent in the IBM system. Also, graphics and font download sequences are made up of binary values for which there are no printable equivalent IBM codes.
The methods described in this chapter will allow escape sequences to be sent entirely as printable IBM characters. This data will pass through host software and telecommunications paths without interference.
F.2 Sending Escape Sequences
Three methods are provided by A/C-6 (RO) to facilitate the transmission of escape sequences to the printer: the user-defined initialization string, escapecharacter definition, and Hex Transfer.
148
A/C-6 (RO)
U
SER
-D
EFINED
I
NITIALIZATION
S
TRING
A/C-6 (RO) has the capability of storing a string of ASCII data in memory using Option 61, USER INITIALIZATION STRING. This data can consist of any ASCII character, including escape sequences. String n is transmitted to the printer by A/C-6 (RO) whenever the printer is powered on (if so configured in Option 51, POWER-UP STRING(S), or when A/C-6 (RO) receives the Zn command, SEND PRINTER INITIALIZATION STRING.
A string can be up to 254 characters in length (see Option 61,
INITIALIZATION STRING, in Appendix A).
The initialization string can be loaded with escape sequences for the transmission of font-selection commands, page-format commands, cursor positioning, etc.
The benefit of using the initialization string is that escape sequences do not have to be sent from the host with every print job. They are sent once to the printer and remembered by A/C-6 (RO).
For example, on an HP LaserJet printer, if you wanted an alternate page format with landscape orientation and the Line Printer compressed-print default font, your Initialization String would look like this:
EC&11OEC(s0T
It would be entered into Option 61, USER INITIALIZATION STRING, as shown below.
&&??%..........................................................................Define % as trigger character
%K61,n,1B,26,6C,31,4F,1B,28,73,30,54%..................Define Initialization
String n (where n=0-7)
&&??<Space> ...............................................................Clear trigger character
E
SCAPE
-C
HARACTER
D
EFINITION
Since the escape character is the first character for escape sequences, this character must be available for the control of the printer’s advanced features.
As mentioned earlier, IBM systems do not have an equivalent control code character. However, this problem can be solved by defining an alternate character for the escape character.
149
A/C-6 (RO)
As described in Appendix D, you can redefine any character received by
A/C-6 (RO) into any other character that is sent to the printer. Thus, using this character translation it is possible to use any regular print character in place of the escape character. Naturally, it is best to select a character for the alternate escape character that is seldom or never used for printing.
This allows escape sequences to be embedded directly in print files. In this manner, commands can be intermixed with print data characters within a file.
To select an alternate character, the Printer Character Translate Table character codes must be changed. A change to this table is made using
Option 75, MODIFY TABLE.
The benefit of using Option 75 is that you have immediate access to all escape sequences not requiring binary data. This allows control of the printer wherever needed with a minimum of overhead.
Once a character is defined as the escape character, it cannot be printed. If required, a character can easily be defined for escape-character use and then redefined temporarily for printing.
For example, let’s say the backward slash is defined as the escape character.
To change from normal to bold printing on an HP LaserJet printer, embed the character sequence \(s3B at the start of a print file.
The print file characters as received by the printer are shown below:
\(s3B .............................START BOLD PRINTING
To change back to normal printing the following sequence should be used:
\(s0B .............................END BOLD PRINTING
NOTE
When using this method to send escape sequences, Option 06, LINE
LENGTH, must be set to 0 or escape sequences will be treated as regular data, resulting in unexpected automatic New Lines.
H EX T RANSFER
Another technique for sending longer escape sequences, for example those needed to print a logo or other graphics image, is transparent data transfer
(see Appendix E).
150
A/C-6 (RO)
Transparent Data-Transfer Options allow sending all escape sequences, including those requiring binary data. The escape sequences used in character-font download and raster graphics are ones that require binary data.
Escape commands that require binary data must be sent transparently through an IBM system. Several options are provided, the most useful being the Hex-Transfer Options. In Hex Transfer, data is sent in hex form using a two-byte or one-byte formula.
By using customizable characters and the availability of multiple techniques including data compression, methods are available that are compatible with most IBM emulation graphics software vendors.
Like all previous methods described, Hex Transfer allows escape sequences to be passed using printable characters. As with Option 75, MODIFY TABLE,
Hex Transfer sequences can be embedded within print files and intermixed with print data.
Designed as a means of sending binary data, escape sequences can be sent using Hex Transparency. Every possible binary value can be represented in hexadecimal notation using the characters 0-9 and A-F. By converting a value to its equivalent two-character hex notation, binary data can then be transferred through an IBM system.
For example, the Hex Transfer method of selecting an italic font on an HP
LaserJet printer (if one is available from either a font cartridge or a previously downloaded soft font) is shown below:
Escape Sequence ...........................................EC ( s 1 S
ASCII Hex code values ..................................1B 28 73 31 53
Previous line is separated .............................1 B 2 8 7 3 3 1 5 3 into 10 individual characters and sent to A/C-6 (RO)
A/C-6 (RO) combines the ...........................1B 28 73 31 53 characters into pairs and transmits them to the printer
For more information about the use and definition of Transparent Data
Transfer Options, see Options 47, 94, 95, and 96 in Appendix A.
151
Pakua
Tangazo