| Previous | Table of Contents | Next |
Hewlett-Packard offers a wide variety of high quality xerographic and ink jet printers with street prices that range from a few hundred dollars to a few thousand dollars, depending on configuration options and design complexity. What is unique about these highly imitated and competitively priced printers is their unusual degree of common programming considerations. Unlike the dot-matrix printer market with highly diverse escape sequences that require distinct programming, most Hewlett-Packard printers use identical escape sequences wherever possible. This greatly simplifies programming Hewlett-Packard printers which, combined with their low cost, comprise excellent devices to conduct color printing experiments.
Hewlett-Packard LaserJet and DeskJet 500 printers produce single-plane bilevel images using xerographic toner and black ink, respectively. The Hewlett-Packard DeskJet 500C produces three-plane CMY bilevel images, and the Hewlett-Packard DeskJet 550C produces four-plane CMYK bilevel images; both printer models use ink jet technology. All of these printers produce 300 dpi output and subsequent DeskJet models produce even higher resolution output using improved inks.
Unchanged, the PRINTPCX.C program produces output on these devices, and slight modifications of the principles illustrated in the program allow users to exploit features on newer Hewlett-Packard printers. So, mastering one printer model allows programmers to apply and expand their skills with the newer models. Because of their combined high quality and low cost, backed by renowned service, it is small wonder Hewlett-Packard holds a well deserved, commanding lead in the printer market, particularly with ink jet printers.
To control Hewlett-Packard printers, the PRINTPCX.C program defines the following escape sequences:
#define ESC '\x1B'
#define DUMMY_VALUE 0x00
USGC HpReset[] = { ESC, 'E' };
USGC HpSetPortraitOrientation[] = { ESC, '&', 'l', '0', 'O' };
USGC HpSetPerfSkipOff[] = { ESC, '&', 'l', '0', 'L' };
USGC HpEndRstrGr[] = { ESC, '*', 'r', 'b', 'C' };
USGC HpSet1PlanePerRowBw[] = { ESC, '*', 'r', '+', '1', 'U' };
USGC HpSet3PlanesPerRowRGB[] = { ESC, '*', 'r', '+', '3', 'U' };
USGC HpSet3PlanesPerRowCMY[] = { ESC, '*', 'r', '-', '3', 'U' };
USGC HpSet4PlanesPerRowKCMY[] = { ESC, '*', 'r', '-', '4', 'U' };
USGC HpSetRstrGrResolution75[] = { ESC, '*', 't', '7', '5', 'R' };
USGC HpSetRstrGrResolution100[] = { ESC, '*', 't', '1', '0', '0', 'R' };
USGC HpSetRstrGrResolution150[] = { ESC, '*', 't', '1', '5', '0', 'R' };
USGC HpSetRstrGrResolution300[] = { ESC, '*', 't', '3', '0', '0', 'R' };
USGC HpSetRstrGrWidth[] = { ESC, '*', 'r', '#', 'S' };
USGC HpSetRstrGrPrintMode[] = { ESC, '*', 'p', '4', 'N' };
USGC HpSetDepletionLevel[] = { ESC, '*', 'o', '1', 'D' };
USGC HpSetShinglingLevel[] = { ESC, '*', 'o', '0', 'Q' };
USGC HpSetRstrGrQualityKeypad[] = { ESC, '*', 'r', '0', 'Q' };
USGC HpSetRstrGrQualityDraft[] = { ESC, '*', 'r', '1', 'Q' };
USGC HpSetRstrGrQualityHigh[] = { ESC, '*', 'r', '2', 'Q' };
USGC HpStartRstrGr[] = { ESC, '*', 'r', '0', 'A' };
USGC HpSetRstrGrCompressionMethod[] = { ESC, '*', 'b', '0', 'M' };
USGC HpTransferRstrGrData[] = { ESC, '*', 'b', '#', 'V' };
USGC HpTransferRstrGrLastData[] = { ESC, '*', 'b', '#', 'W' };
Some of these escape sequences, such as HpSetRstrGrWidth, contain a #. This indicates an integer value is substituted in place of the # character. The following routine transmits escape sequences to Hewlett-Packard printers and performs this translation using sprintf():
int XmitHpEscapeSequence(USGC *EscSeqArray, int EscSeqSize, int Value)
{
USGI EscSeqIndex, FormatIndex;
USGC FormattingBuffer[10];
for (EscSeqIndex = 0;
EscSeqIndex < EscSeqSize;
EscSeqIndex++)
if (EscSeqArray[EscSeqIndex] != '#')
PrintByte(EscSeqArray[EscSeqIndex]);
else
{
sprintf(FormattingBuffer, "%u", Value);
for (FormatIndex = 0;
FormatIndex < strlen(FormattingBuffer);
FormatIndex++)
PrintByte(FormattingBuffer[FormatIndex]);
}
return 0;
}
| Previous | Table of Contents | Next |