HP82240B IR Printer Protocol


I have purchased a IEI Keypad for access control that will print its buffer to the HP82240B printer. It looks like the keypad only transmits IR(no recieve diode). I would like to build an IR reciever to hook up to RS232 port. I cant seem to find any info on the printer as far as protocol, baud rate, etc... I did find a printer emulator but still have the problem of the IR to RS232 conversion. If anybody could offer any help or suggestions I would greatly appreciate it!
Thanks in advance,


Check in the articles forum.

The URL to go there directly is:



I knew I had it somewhere, and I've found it. The HP spec for talking to the IR printer. This is written assuming you want to drive the printer from some other device (rather than decode the IR stream from a device designed to talk to the printer), but it may be some help.
Everything is timed from a 32768Hz clock. 1 half-bit-time is defined as 14 cycles of that clock, so not suprisingly a full bit time is 28 cycles. The IR 'burst' is 6-8 pulses of the master clock at 50% mark-space ratio. It is important, it appears, that all those pulses should be full-width -- no 'runts' at the start or end of the burst.
A '1' bit is sent by having an IR burst at the start of the first half-bit-time -- that is to say 7 clock cycles when the IR LED Is turned on by the clock, then 21 cycles where nothing is emitted. A '0' bit is sent by a IR burst at the start of the second half-bit-time -- 14 cyles of nothing, 7 when the IR LED is turned on by the clock, 7 more cyles of nothing.
The start of a character is defined by IR bursts in 3 consecutive half-bit-times (this can occur nowhere else in the character, of course). Then 12 bits are sent, MSB first. Then there must be at least 3 half-bit-times when nothing is sent.
As I said, a character is 12 bits long. It's sent MSB (bit 11) first. The last 8 bits (7..0) are the 8 bit ASCII code for the character.
The top 4 bits are parity bits. They are set if the total number of 1's in each group (which I'll give below) is odd. That is to say, the bit together with its group forms an _even_ parity set.
The group for each parity bit is :
11 - { 6, 5, 4, 3} ;
10 - { 7, 6, 5, 2, 1} ;
9 - {7, 6, 4, 2, 0} ;
8 - {7, 3, 1, 0}.
The idea is that single-bit errors can be corrected. If you just want to decode the IR stream sent by some other device, then you can ignore the parity bits. If you want to drive the printer
you must get them right.


Tony: thank you for this detailed description!

Just from my memory (I may be wrong) I remember an HP Journal issue (around mid 1988) where the 82240 protocol was described. The "odd" thing (no pun intended) was that the parity bits were explained as the logic AND of each group, instead of the logic XOR, which is far more "logic" (again, no pun intended).

Certainly XOR is a more useful function in this case, the reported use of AND puzzled me as much as to remember the issue some 12 years after seeing that publication.

May I also suggest you to see interesting postings/articles here at the Museum, by Steve from Australia, in which he describes his succesful intents on capturing the IR pulse stream and decoding it on a PC.


The document that I have certainly implies that the check bits are
calculated by an XOR function. It uses terms like 'An even parity bit' and goes on to explain that the
total number of '1's in the set of bits being checked together with the check bit is always even. To me that implies an
XOR function. I think I've seen the HP journal articles, but I don't think they were totally explicit about the protocol. They were certainly a great help at explaining
what I was seeing on the logic analyser, though.


Certainly XOR makes much more sense than AND... I agree.


Actually a combination of AND and XOR is used to calculate the ECC, as copied from my article...


How do we get the ECC? well it's like this...

The 4 bits (call them H1, H2, H3, and H4) are calculated individually

Firstly for each bit you apply a mask (AND) to the data

the masks are:

H1 01111000

H2 11100110

H3 11010101

H4 10001011

So for the code 01000001 the resulting data for these is

H1 01000000

H2 01000000

H3 01000001

H4 00000001

Then you calculate the EVEN parity bit required for these (i.e. the bit required so that there are an EVEN number of bits. Since H1, H2, and H4 have an odd number of bits, the parity bit for these would be 1, bit for H3 it is 0.

Then you string them together (the parity bits) this gives you:

1101 which is what we found above!

These parity bits can be used to detect and correct up to two missed bits (though how you do that is well beyond what I'm prepared to go into!)


The masks are ANDed with the byte so that each ECC bit represents only 4 or 5 bits of the original data byte.

Then the even parity is generated and used as the ECC bit.

Calculating parity can be seen as an XOR operation. If you XOR all the bits together you will end up with the even parity bit (inverting this gives you an odd parity bit)

One thing that I find very interesting about this protocol is that it can be viewed as having the information not carried in the signal, but in the gaps between the signals. And decoding it this way means that you do not have to worry too much with exact timings.


OK, now I see what you mean. I'm a hardware type, and I was thinking in terms of
selecting the various bits for each checkbit by (literally) soldering wires to them and running them to a tree of XOR gates. I don't think it terms of the AND function to select a fixed subset of bits from a word -- it's just connecting wires :-)
But I can see why prgrammers would think it terms of the AND function to do this.
I guess we're all agreed that the checkbits are calculated from an XOR of a subset of the bits in the character, though.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help: HP-41CX and IR module Marcel Samek 13 4,040 11-14-2013, 11:00 AM
Last Post: Marcel Samek
  IR printer failure Andrew Nikitin 7 2,491 11-05-2013, 11:25 AM
Last Post: Andrew Nikitin
  Trouble dumping Pioneer ROM via IR Neil Hamilton (Ottawa) 6 2,499 06-20-2013, 08:14 AM
Last Post: Neil Hamilton (Ottawa)
  HP42S and IR printer matti 9 2,780 06-10-2013, 12:11 PM
Last Post: matti
  Does IR printing not work on your converted WP34s? Then read on... Harald 3 1,648 04-04-2013, 05:46 PM
Last Post: Harald
  IR Link Problem: HP48 <-> PC Waon Shinyoe (China) 1 1,141 03-16-2013, 03:37 AM
Last Post: Eric Smith
  WP-34s data exchange with PC over IR Marcel Samek 3 1,521 02-26-2013, 11:53 PM
Last Post: Marcel Samek
  The HP82240B Printer Jose Gonzalez Divasson 9 2,641 02-25-2013, 01:56 AM
Last Post: Nick_S
  WP34s IR Printing Update? Thomas Chrapkiewicz 2 1,273 02-24-2013, 01:53 PM
Last Post: Marcus von Cube, Germany
  [WP-34s] Updated: How to install crystal and IR diode Alexander Oestert 2 1,515 06-17-2012, 12:19 PM
Last Post: Geoff Quickfall

Forum Jump: