Main Menu

KB#00064-Sending escape codes to a printer by utilizing the BO and EO mnemonics

Title:

Sending escape codes to a printer by utilizing the BO and EO mnemonics

Description:

While the printer is in its default state, "line buffered" or parallel mode, mnemonics are enabled. One way to get around this is to disable mnemonics with the 'BO' (begin output transparency) mnemonic: 

>PRINT (1)'BO',$1BXXXX$,'EO',"RED" 

where $1B$ is hex for an ESCAPE and $XXXX$ is your particular printer's code (also in hex) to use the red ribbon. 

Data printed in output transparency will be sent to the printer immediately, affecting the data already in the printer line buffer, as well as data printed after the output transparency, until a different escape sequence is sent (through output transparency). 

The above example implies that a line feed is sent at the end, which flushes the printer buffer, and since there was only one escape sequence sent (for the red ribbon), it worked as expected. 

But what if you would like to intermix red and black print on one line? 

Look at the following possible problem: 

>PRINT (1)"BLACK",'BO',$1BXXXX$,'EO'," RED ",'BO',$1BYYYY$,'EO',"BLACK" 

Since the $1BYYYY$ code (for the black ribbon) was sent last (before the implied line feed flushed the printer line buffer), the entire line will be in black. What is needed in this case is serial mode ('MS'). The 'cursor' "@" positioning, slew commands, and line buffering are disabled, but now we can send escape sequences directly to the printer: 

>PRINT (1)'MS',"BLACK",'ES',$XXXX$," RED ",'ES',$YYYY$,"BLACK",'MP' 

In serial mode, the order of the data is maintained, and "BLACK RED BLACK" will be printed with the correct color of ribbon, as requested. 'ES','CR', 'LF', and 'FF' mnemonics will still work in serial mode. 'MP' will then return the printer to parallel mode, it's default state. 



Last Modified: 12/18/1997 Product: PRO/5 Operating System: All platforms

BASIS structures five components of their technology into the BBx Generations.

  Google+ View BASIS LinkedIN Profile Visit our Twitter Feed Check out our Facebook Public Profile Click to View the BASIS youTube channel