Sweep data explanation

It took me quite a while to understand the explanation of the sweep data from the HP Journal articles, so I will try to explain it in a little clearer terms here.

The swing buffer separation applies for black as well as CMY sweeps. I have only deciphered the ordering for the black data, however.

What's a sweep?

Let's first start off by describing how the nozzles on the printhead are arranged.

For the black nozzles, there are 300 total nozzles. They are numbered from 1 to 300. There are two columns of nozzles - odd and even. The odd colum consists of 150 nozzles separated by 1/300 of an inch. The even column is similar, but it is shifted down 1/600 of an inch from the odd column. Thus, we can get 300 dpi by printing with one column and 600 dpi by printing "between the lines" with the other column.

For the color nozzles, each color (CMY - cyan, magenta, yellow) has 64 nozzles. They are split into two columns of 32 nozzles each. The odd column has nozzles separated by 1/150 of an inch, and the even column has the same set of nozzles, but shifted 1/300 of an inch down. This allows us to get 300 dpi color. (This may differ slightly on printers other than the 820Cse)

When the printer prints a graphical image, it must convert the image data into a form that it can understand. The first task is to separate the image into swaths. Let us assume that we have a black-and-white bitmap that is X pixels wide and Y pixels tall that we want to send to the printer. We must cut this into several swaths, each of a certain height. For example, we might choose to cut it into swaths that are 300 pixels high (1/2 an inch). This produces a series of bitmaps that are X by 300 pixels in dimension.

With this swath data, we can now produce a series of sweeps. A sweep is simply a set of data that tells the printhead how to move across the page and what data to print. For each swath, there may be only one sweep, or there may be multiple sweeps.

Formatting the sweep data

The sweep data is formatted in a very specific way so that the printer can understand it. The first thing that we need to do is convert the bitmap data into the correct form. The form that is required looks like this:

Columns 0-7Columns 8-15... Columns ceil(X/8)*8-8 to ceil(X/8)*8-1
Byte 0Byte 1...Byte ceil(X/8)-1
Byte ceil(X/8)Byte ceil(X/8)+1...Byte 2*ceil(X/8)-1
............

Each of the 8 bit values are packed into a byte in big-endian order.

To give a more concrete example, assume we have a sweep that is 64 pixels wide and 8 pixels tall. Here is what our data organization will look like:

Col 0-7Col 8-15Col 16-23Col 24-31Col 32-39Col 40-47Col 48-55Col 56-63
Row 0 Byte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7
Row 1Byte 8Byte 9Byte 10Byte 11Byte 12Byte 13Byte 14Byte 15
Row 2Byte 16Byte 17Byte 18Byte 19Byte 20Byte 21Byte 22Byte 23
Row 3Byte 24Byte 25Byte 26Byte 27Byte 28Byte 29Byte 30Byte 31
Row 4Byte 32Byte 33Byte 34Byte 35Byte 36Byte 37Byte 38Byte 39
Row 5Byte 40Byte 41Byte 42Byte 43Byte 44Byte 45Byte 46Byte 47
Row 6Byte 48Byte 49Byte 50Byte 51Byte 52Byte 53Byte 54Byte 55
Row 7Byte 56Byte 57Byte 58Byte 59Byte 60Byte 61Byte 62Byte 63

Our next task is to separate this data into swing buffers. Since the odd and even nozzles on the printhead are physically separated, we must extract the appropriate rows of pixels to give to the printer. Two swing buffers are created for each column of bytes. The first is the odd swing buffer, and the second is the even swing buffer. These correspond to which pins will be printing the data. Thus, the odd swing buffer for the first column in the above example would look like this: (Note added: from inspection of the pbm2ppa and pnm2mma code, this seems to be the even swing buffer, not the odd one (?))

Byte 0
Byte 16
Byte 32
Byte 48

And the even swing buffer looks like this: (Note added: this seems to be the odd swing buffer (?))

Byte 8
Byte 24
Byte 40
Byte 56

Ordering the swing buffers

Now we have odd and even swing buffers for each of the columns in the print sweep. The next thing for us to do is order these swing buffers and send them to the printer.

From experimentation, I have determined the ordering for the black data on the 820Cse.

  1. First, the odd swing buffers for the left 12 columns are sent as sweep data.
  2. Next, the odd swing buffer for the 13th column is sent, followed by the even swing buffer for the first column. This alternates until we run out of odd swing buffers.
  3. Finally, the even swing buffers for the last 12 columns are sent.

From experimentation, it seems that the values of the first and last 12 columns of data MUST be all 0's. Otherwise, strange results occur, including the repetition of a single swing buffer across the whole sweep.

Here is a quick reference for the ordering of the swing buffer data, assuming X columns of data.

Odd swing buffer for column 0
Odd swing buffer for column 1
...
Odd swing buffer for column 11
Odd swing buffer for column 12
Even swing buffer for column 0
Odd swing buffer for column 13
Even swing buffer for column 1
...
Odd swing buffer for column X-1
Even swing buffer for column X-13
Even swing buffer for column X-12
Even swing buffer for column X-11
...
Even swing buffer for column X-1

For different printers and color printing, the number of columns to send before we start interleaving seems to vary.