Go home!   The protocol page.   The driver page.

Lexmark 5000 Swipe Command

The swipe (or swathe) command initiates a pass of the printheads across the paper and feeds data to the pen(s) on one of the cartridges, printing a band of black or colour on the paper.  No paper movement is initiated by this command.

Uncertain elements are coloured orange; unknown elements are coloured red.

Command Header

Esc4, L1, L2, L3, L4, 0, Dir, PS1, PS2, NC, Q1, CC1, CC2, SC1, SC2, EC1, EC2, 0, 0, ID1, ID2, ID3, ID4, 1

L1 - L4
The total length of the command, including header.  Four bytes in network order, most to least significant.
Dir
Direction and speed indicator?  Values seen from the Windows driver for the 5000 are:
  • 01 Unidirectional (300x600dpi)
  • 02 Unidirectional (600x600dpi)
  • 05 Unidirectional (600x1200dpi)
Other values used in the corresponding byte by other drivers include:
  • 02 Black printing - 7000 driver (Henryk)
  • 03 Colour printing - 7000 driver (Henryk)
  • 03 Black printing 1200dpi - 5700 driver (Stephen)
PS1 PS2
Pen select 1 and pen select 2 bytes. Values used in the 5000 driver are:
  • 01 01 Black
  • 02 00 Colour
Variations seen:
  • 01 00 Colour - 7000 driver
NC
Nozzle count determines the use of 192 or 208 nozzles.  More precisely, it is the number of bytes of data required to drive all of the nozzles being used.
  • 0x18 192 nozzles (i.e. 24x8=192)
  • 0x1A 208 nozzles (i.e. 26x8=208)
For colour printing, only 192 nozzles are valid.  When printing black with 192 nozzles, the Alignment B value from the page initialisation command is automatically invoked.  See also this discussion of the complications of alignment.
Q1
A mystery byte.  Values seen include 0, 1, 6, 9, 0x21, 0x1C, 0x13, 0x17 and 0x11.
CC1 CC2
Column count.  A two byte count of the columns to be printed in this swipe, most significant byte first.
SC1 SC2
Start column.  A two byte offset, most significant byte first, of the first column to print.
EC1 EC2
End column.  A two byte offset, most significant byte first, of the last column to print.
CC = EC - SC + 1.
ID1 - ID4
Driver ID bytes 1 to 4.  Values seen in output from the Windows driver are always:
  • 0x22 0x33 0x44 0x55
In the head alignment output file (jolxalgn.out) the values are:
  • 0x32 0x33 0x34 0x35
  • i.e. ASCII `2' `3' `4' `5'
This is why I suspect some sort of driver identification sequence.  Altering these values has no discernible impact on the output from the printer.

Command Data

Relating column data to nozzles

The header defines the range of columns to be printed in this command, and the data portion of the command is comprised of data for successive single columns.  Data is sent to the printer in 16 bit words in network order, i.e., most significant byte first.

The number of nozzles for each pen and for each cartridge in each mode is a multiple of 16: each colour pen is 64 (4*16) nozzles; the total number of nozzles for a colour swipe is 192 (12*16); the number of nozzles on the black pen is 208 (13*16), and when the black pen is operating in colour compatible mode it also uses 192 nozzles.

Words of data are sent in reverse order of nozzles; the first data word will contain data for the highest numbered nozzles which are being activated for this column, and the last data word for the lowest numbered nozzles.  Within a data word, the most significant bit controls the lowest numner nozzle in the group of 16, and the LSBit controls the highest numbered nozzle.

In this driver, column data are always structured according to one of two compression schemes. The data for each column is preceded by a 16-bit directory, followed by from 0 to 12 (for 192 nozzles) or 13 (for 208 nozzles) data words.

Normal directory entries.

A normal directory word contains the bit `0x2000' and, as far as I have detected, no higher bits.  If the NC byte of the swipe command contains `0x18', the value of the bit `0x1000' is disregarded, although it will usually be set to `0' to match the nozzle count specifier. In all directory entries, bits set to zero indicate that a 16 bit word will follow in sequence. A bit set to 1 in the directory is equivalent to a data word with a value of `0x0', i.e., no pixels to print for any of the 16 nozzles.

Therefore, in a swipe with a nozzle count specifier of `0x1A', indicating 208 nozzles, a directory value of `0x3fff' ( 00 11 1111 1111 1111 ) indicates a column with no pixels to print. Similarly, for a specifier of `0x18', indicating 192 nozzles, a directory value of `0x2fff' ( 00 10 1111 1111 1111 ) indicates a null column. (Note that `0x3fff' would have the same meaning, as the `0x1000' bit would be ignored.)

With a specifier of `0x1A', a directory value of `0x2fff' ( 00 10 1111 1111 1111 ) would indicate that one data word follows, mapping the highest numbered nozzles of the set of 208, i.e., those at the bottom of the printhead. It would be equivalent to an entry of `0x2000', followed by 12 data words containing 0, and one data word containing the bit pattern for nozzles 192-207.

This in general is the case. A 1 bit in the directory implies a data word of 0 at that position on the printhead; only data words containing at least one 1 bit need be included in the swipe command, and are indicated in the directory by a 0 bit.

E.g., the directory entry 0x2bfe, ( 00 10 1011 1111 1110 ) when 192 nozzles are specified, would have to be followed by two 16 bit data words. The first, corresponding to the 0 bit of the last nybble, 0xe (0b1110) would contain the pixel pattern for nozzles 0-15. The second, corresponding to the 0 bit in the second nybble, 0xb (0b1011), would contain the pixel pattern for nozzles 160-175.

If the same directory entry were used when 208 nozzles had been specified, it would be followed by three data words. The first two would have the same correspondences, specifying the same nozzles. The third word, corresponding to the least significant 0 bit in the first nybble, 0x2 (0b001>0<), would contain the pixel pattern for nozzles 192-207.

Multiplier directory entries

When the `0x2000' bit in a directory entry is set to 0, the directory is a multiplier entry. It encodes both the number of data words to follow, and a multiplier to apply to each. It is useful when the pixel pattern for all nozzles can be reduced to a small number of contiguous sets with identical pixel patterns, e.g., the top 5*16 with a common pattern, the next 3*16 with another pattern and the remaining 5*16 with a third pattern.

Certain effects are common to the multiplier and to the normal directories. The number of zero bits determines the number of data words and the order in which they follow (the reverse of the order of zero bits in the directory.) Contiguous least significant 1 bits in the directory always imply a word of zeros in the corresponding nozzle position. A directory ending in 01 implies a word of zeros for nozzles 0-15. The means that, when the following data words are multiplied, the required total is reduced by one. A directory ending in 011 imples two words of zeros for nozzles 0-31, etc.

The coding scheme for these multipliers is simple and elegant. Zero bits serve two functions: they indicate the number of following data words, and they serve as `fences' within the bit pattern of the directory word, marking the boundaries of the effect of the data word with which they are associated. Assuming a 208 nozzle directory entry, take the bit pattern ( 00 01 1111 1111 1100 ) x1FFC As with normal entries, the bits apply to the following data words in reverse order. There are two zero bits, so two data words follow. The last zero applies to the first word, the previous zero applies to the second word.

     1 1111 1111 1100
                    ^
Start counting backwards from the last zero, until immediately before the next zero is encountered. Result: 1.

     1  1111  1111  1100
     .  ....  ....  ..^
Start counting backwards from the next zero, until immediately before the next zero is encountered. Result: 12.

Application of the first data word: 1*16 from the lowest numbered nozzles. Application of the second data word: 12*16 from the next lowest numbered nozzles.

Try

     1  1111  1111  1110         x1FFE
     .  ....  ....  ...^ 13
One zero bit, countback 13. Application of the one following data word: 13*16.

     1  1110   1011  1110        x1EBE
                 ..  ...^ 6
               .^ 2
     .  ...^ 5
Data word 1 is applied to the top 6*16 nozzles; data word 2 is applied to the next 2*16 nozzles; data word 3 is applied to the last 5*16 nozzles.

     1  0110   0110  1010       x166A
                       .^ 2
                     .^ 2
                ..^ 3
               ^ 1
         ..^ 3
     .  ^ 2

Six zero bits, therefore six data words, with application 2*16, 2*16, 3*16, 1*16, 3*16, 2*16

Remember that any contiguous one bits at the end of the string imply a corresponding zero data word as the (implied) first word of data.

     1  1101   1110  1011       x1DEB
                       .. 2  Implied first data word of 0
                     .^ 2    Applies to first actual data word
           .   ...^ 5        Applies to second actual data word
     .  ..^ 4                Applies to third actual data word
When the specified nozzle count is 192, the 13th bit (which is usually set to 0 in these circumstances), does not enter into the calculation.

Note that the degenerate case (an empty column) is the same for both methods. There will be no data words and no zero bits in the directory entry. The only difference will be that the 0x2000 bit will not be set for the multiplier directory entry. Either can be used.

Note also that the other `degenerate' case (all words used, no contiguous identical data words) will also generate an identical data set, with only the 0x2000 bit differing.


Go home!   The protocol page.   The driver page.


Created with

Last modified: Mon Nov 8 00:09:51 EST 1999

Tue 19th Oct 1999.