Calculators with Support of the 82240 IR-Printer
06-25-2014, 05:09 PM (This post was last modified: 06-26-2014 08:27 AM by Martin Hepperle.)
Post: #1
 Martin Hepperle Member Posts: 221 Joined: May 2014
Calculators with Support of the 82240 IR-Printer
In order to test the IR-emitter on my new WP-34S I acquired a cheap 82240B printer. I like having a wireless option for transferring data, even if it is only one-way.

For comparison I used a HP-48G and was astonished by its range (several meters), while the WP-34S with its tiny batteries is by design more power limited and therefore on the lower side (about 10 cm).
While the 48G gives me more freedom to chose text output or graphics output I noticed that the WP-34S sends all its output in the form of bitmap graphics (probably the only way to cover its extended character set).

To complete this work I also wrote a small Arduino program to capture the IR signal and forward it via RS232 to my PC. Thus I can now capture text from the HP-48 as numerical input for other applications or control other devices (or printers) with the Arduino. This also works nicely with Christoph Gießelinks printer emulator, complete with graphics. This is a very helpful piece of software.

While I was searching for information about the protocol, I noticed that there was a quite large number of calculators supporting this little printer. So I composed a list below - maybe this is of interest to someone.
Any comments are welcome. For example I do not know whether some of the PDA machines also support this protocol.

Calculators which use the infrared "redeye" protocol (understood by 82240A/B printers):

HP-17B
HP-17BII
HP-17BII+
NOT HP-18B {copied from HP Solve N18/2010 deleted, should be 18C, see reply by Massimo}
HP-18C
HP-19B
HP-19BII
HP-27S
HP-28C
HP-28S
HP-32S {deleted, see reply by Bob, Katie}
HP-38G
HP-39G
HP-39GS
Hp-41C, CX, CV (with IR-Interface module HP 82242)
HP-42S
HP-48S
HP-48SX
HP-48G
HP-48GII
HP-48GX
HP-48G+
HP-49G+
HP-50G (IrDA, but switchable to 82240 protocol, distance less than 20mm)
NOT: HP-Prime (IrDA?, not useable with 82240?){corrected, see reply by Joe}
WP-34S

Other 3rd party non-calculator devices, like central heating measurement devices etc.
06-25-2014, 05:55 PM
Post: #2
 Joe Horn Senior Member Posts: 1,565 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-25-2014 05:09 PM)Martin Hepperle Wrote:  ...Calculators which use the infrared "redeye" protocol (understood by 82240A/B printers):
... HP-Prime (IrDA?, not useable with 82240?) ...

Prime has no IR I/O of any kind.

<0|ɸ|0>
-Joe-
06-25-2014, 05:58 PM
Post: #3
 rprosperi Senior Member Posts: 3,746 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
I did not recall that the HP-32S supported IR printing, however if it indeed does so, then it's almost certain that the HP-32SII does as well. As I said though, I don't think it does, but could well be wrong on this.

--Bob Prosperi
06-25-2014, 06:03 PM (This post was last modified: 06-25-2014 06:07 PM by Massimo Gnerucci.)
Post: #4
 Massimo Gnerucci Senior Member Posts: 1,829 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
I don't know what an HP-18B is/was...

P.S. My compliments for your work on the Arduino

Greetings,
Massimo

-+×÷ ↔ left is right and right is wrong
06-25-2014, 06:05 PM
Post: #5
 Katie Wasserman Super Moderator Posts: 629 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-25-2014 05:58 PM)rprosperi Wrote:  I did not recall that the HP-32S supported IR printing, however if it indeed does so, then it's almost certain that the HP-32SII does as well. As I said though, I don't think it does, but could well be wrong on this.

You're correct there is no IR emitter nor IR firmware in the 32s nor 32sii.

However, there are many third party devices that use the 82240A/B printer as an output device for their function. It's not just for calculators.

-katie

06-25-2014, 06:21 PM
Post: #6
 Tony Duell Junior Member Posts: 38 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-25-2014 06:05 PM)Katie Wasserman Wrote:  However, there are many third party devices that use the 82240A/B printer as an output device for their function. It's not just for calculators.

And at least one other HP device. The LogicDart (a handheld 3-channel logic analyser) will print its captured waveforms on the 82240.
Post: #7
 Christoph Giesselink Member Posts: 160 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
For sure the HP-95LX has also the necessary hardware. And with a little software help we can send data to the printer:

Code:
                 PAGE    60,132                 TITLE   HP-IR-REDEYE-Interface C-Modul for HP-95LX ;*********************************************************************** ; HP-IR-REDEYE-Interface C-Modul, ; ; (c) Christoph Giesselink, 1993 ; ; created at 26.03.93 ; ; TRANSLATOR: masm 5.1 with /ML switch ;*********************************************************************** .MODEL SMALL,C .CODE                 ASSUME  CS:_TEXT,DS:NOTHING,ES:NOTHING,SS:DGROUP ; Equations IRFMAT          equ     0e30ah                  ; IR Format Register IRCNT           equ     0e30bh                  ; IR Transmit/Receive Register LBF_MASK        equ     20h                     ; mask for LBF from IRFMAT LBR_SET         equ     02h                     ; set bit in IRCNT REDEYE_TYP      equ     01h                     ; IR in Redeye Format ; correction masks hmask:          db      78h,0e6h,0d5h,8bh       ; Mask for error bits ;********************************************************************** ; ;  Funktionname....:  s_redeye ; ;  Description.....:  send a Byte over the IR interface in ;                     REDEYE-Format ; ;  Input...........:  unsigned char zeichen : byte to send ; ;  Return..........:  void ; ;********************************************************************** ; void s_redeye(unsigned char zeichen); s_redeye        PROC    zeichen:BYTE ; initialize interface                 mov     dx,IRFMAT               ; at IR Format register                 mov     al,REDEYE_TYP           ; choose type REDEYE                 out     dx,al                 mov     cl,zeichen              ; load character to cl ; calculate correction bits H(i)                 mov     bx,OFFSET hmask         ; H(i)                 mov     al,4                    ; ch = Parity, al = counter ploop:          test    cl,cs:[bx]              ; value and correctin mask                 jpe     evp                     ; jump on parity even                 stc                             ; set parity odd evp:            rcl     ch,1                    ; rotate into parity result register                 inc     bx                      ; next mask                 dec     al                 jnz     ploop                   ; until 4 parity bits calculated ; cx = H1-H4,D7-D0,0000                 shl     cx,1                    ; shift 4 bit left                 shl     cx,1                 shl     cx,1                 shl     cx,1                 inc     cx                      ; prepare for first burst                 xor     bx,bx                   ; bh=subevent, bl=event counter ; main loop main:           in      al,dx                   ; fetch IR state                 and     al,LBF_MASK             ; mask LBF bit                 jnz     main                    ; bit set, wait                 test    cl,1                    ; 1 = send burst                 jz      nburst                  ; no bursts                 mov     al,LBR_SET              ; set burst bit in LBR nburst:         inc     dx                      ; I/O to IRCNT                 out     dx,al                   ; send                 dec     dx                      ; I/O auf IRFMAT                 xor     bh,1                    ; toggle subevent                 cmp     bl,2                    ; event >= 2                 jnc     b_inc                   ; no                 inc     bl                      ; event 0,1,2                 jmp     SHORT main b_inc:          and     bh,bh                   ; first half?                 jz      mburst                  ; no                 rol     cx,1                    ; fetch next bit                 jmp     SHORT e_inc mburst:         xor     cl,1                    ; burst toggle e_inc:          add     bl,bh                   ; event = event + subevent                 cmp     bl,15                   ; event < 15 ?                 jc      main                    ; character not finished                 xor     cl,cl                   ; no more bursts                 cmp     bx,16                   ; event 16, 2nd half?                 jnz     main ; wait until last bit send eloop:          in      al,dx                   ; fetch IR state                 and     al,LBF_MASK             ; mask LBF bit                 jnz     eloop                   ; bit set, wait                 ret s_redeye        ENDP                 END
06-25-2014, 07:38 PM
Post: #8
 everettr Member Posts: 60 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
Hi,
I was just thinking about doing the same thing, using an Arduino nano.
What sort of IR detector did you use? I am looking at Mouser part # 782-TSOP34833.
Were you able to use or adapt a published Arduino IR library to decode the HP protocol? I have seen an HP article on the origins of the protocol, but have no idea if it is anything like current IR remote control protocols.

A device like this ought to be really useful for uploading programs from a 42s to a PC, assuming anyone would still want to do something like that.
06-25-2014, 07:52 PM
Post: #9
 Christoph Giesselink Member Posts: 160 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-25-2014 07:38 PM)everettr Wrote:  I am looking at Mouser part # 782-TSOP34833.

The TSOP34833 will not work. The minimum burst length for this chip is 10 cycles/burst. HP calculators use 6-8 bursts. First I used the TSOP1833 and later the TSOP4133 chip as receiver.
06-25-2014, 08:15 PM
Post: #10
 everettr Member Posts: 60 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-25-2014 07:52 PM)Christoph Giesselink Wrote:  The TSOP34833 will not work. The minimum burst length for this chip is 10 cycles/burst. HP calculators use 6-8 bursts. First I used the TSOP1833 and later the TSOP4133 chip as receiver.

Thanks for pointing that problem out. I see it now in the data sheet, and will look at the TSOP4133 instead.
06-26-2014, 07:58 AM
Post: #11
 Martin Hepperle Member Posts: 221 Joined: May 2014
RE: Calculators with Support of the 82240 IR-Printer
(06-25-2014 07:38 PM)everettr Wrote:  Hi,
I was just thinking about doing the same thing, using an Arduino nano.
What sort of IR detector did you use? I am looking at Mouser part # 782-TSOP34833.
Were you able to use or adapt a published Arduino IR library to decode the HP protocol? I have seen an HP article on the origins of the protocol, but have no idea if it is anything like current IR remote control protocols.

A device like this ought to be really useful for uploading programs from a 42s to a PC, assuming anyone would still want to do something like that.

Hello,

without giving much thought or research, I had ordered a small IR-receiver board from China, mounted with 2 condensers and 2 resistors as per datasheet - just right for tinkering with the Arduino. It came with a VS1838B, which is probably the same as a TSOP1383B. This chip is for 38 kHz, which is relatively far away from the nominal 32.768 kHz of the HP spec, but this seems to be less critical - my unit works very well also over several meters with a HP 48G (per datasheet it should have a reduced receptivity of about 50% compared to a 32kHz receiver). Reading through some sources, I learned that some detectors detect signals only with 10 and more bursts, while the HPs per definition send 6-8 bursts. This seems to a be critical factor, so you should make sure you select a receiver designed for 6 or more bursts, NOT 10.
So I would recommend to select a 33 kHz receiver for 6+ pulses, e.g. a TSOP1833 chip (33 kHz, 6+ pulses), but the 1830, 1836, 1837 1838 might also work well enough).

I did not use any Arduino libraries except for the Serial output library as it is more fun to develop and understand something than just using black box stuff. I also used i/o and timer interrupts to implement the time critical parts, which leads to a relatively large code size when using Arduino libs. The resulting code is about 5 kBytes including 1 bit error checking, which should be okay to put it in a small chip directly at the end of a USB-TTL cable. Or in a small printer or whatever device is of interest. I also want to add some ESCape sequences to control e.g. power outlets etc. The printer specs leaves some room here without harming the printer function.
After finishing the developing on the Leonardo, I want to put the code into a Nano or Micro as a final solution. An Arduino with USB/Serial (like the Pro) can be directly used as a IR->Serial adapter or you can even simulate a keyboard using your pocket calculator.

I just finished the first version of the code and can make it available if you are interested. I am just adding some comments so that the code is understandable.

Martin
06-26-2014, 10:01 AM
Post: #12
 J-F Garnier Senior Member Posts: 338 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-25-2014 06:05 PM)Katie Wasserman Wrote:  However, there are many third party devices that use the 82240A/B printer as an output device for their function. It's not just for calculators.

I'm interested to know more on third party devices that use the 82240 printer, can you give more information?
I know the HP Logicdart (I'm happy to have one) mentioned by Tony.

Thanks,
J-F
06-26-2014, 10:36 AM
Post: #13
 Paul Dale Senior Member Posts: 1,546 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-25-2014 05:09 PM)Martin Hepperle Wrote:  ...I noticed that the WP-34S sends all its output in the form of bitmap graphics (probably the only way to cover its extended character set).

Marcus is the expert here, but my understanding is that the 34S will only switch to graphical output if it needs to or if a graphic register set is printer.

- Pauli
06-26-2014, 06:27 PM
Post: #14
 Marcus von Cube Senior Member Posts: 760 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-26-2014 10:36 AM)Paul Dale Wrote:
(06-25-2014 05:09 PM)Martin Hepperle Wrote:  ...I noticed that the WP-34S sends all its output in the form of bitmap graphics (probably the only way to cover its extended character set).

Marcus is the expert here, but my understanding is that the 34S will only switch to graphical output if it needs to or if a graphic register set is printer.

You can configure printing with the pMODE command (replace p by the printer symbol).

pMODE 0 is the default mode, a mixture of text and graphics printing.
pMODE 1 prints everything as graphics.
pMODE 2 prints everything as graphics, using the small character set.
pMODE 3 "prints" to the serial port (9600,8,N,1). ASCII only!

@Martin: The IR range depends on the type of IR LED. Katie has made some experiments. I don't recall the exact details, but I can send you one of mine.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
06-26-2014, 10:08 PM (This post was last modified: 06-27-2014 03:00 PM by everettr.)
Post: #15
 everettr Member Posts: 60 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
I was confused about pulses and bursts, and how the IR detector interprets them. It is getting clearer to me now. I will probably go with the TSOP4133 part that Christoph suggested, though I am sure this is very similar to those that you listed.

5 Kb, what a whopper :-) If it fits the flash and meets the timing constraints, no problem. It sounds like you are using interrupts for both the serial and the burst timing. I would like to see how you did that, since I have been wondering if some sort of caching/buffering of data would be needed to separate IR operations from serial communications. That is an interesting idea about additional ESC sequences, but how would you persuade a calculator to emit the new sequence?

(06-26-2014 07:58 AM)Martin Hepperle Wrote:  I just finished the first version of the code and can make it available if you are interested. I am just adding some comments so that the code is understandable.
I am definitely interested in seeing your project!
Thank you,
06-26-2014, 10:44 PM
Post: #16
 walter b On Vacation Posts: 1,957 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-26-2014 06:27 PM)Marcus von Cube Wrote:
(06-26-2014 10:36 AM)Paul Dale Wrote:  Marcus is the expert here, but my understanding is that the 34S will only switch to graphical output if it needs to or if a graphic register set is printer.

You can configure printing with the pMODE command (replace p by the printer symbol).

See the manual, p. 130 of v3.2 or p. 117 of v3.1.

d:-)
06-27-2014, 02:43 AM (This post was last modified: 06-27-2014 02:57 AM by Katie Wasserman.)
Post: #17
 Katie Wasserman Super Moderator Posts: 629 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-26-2014 10:01 AM)J-F Garnier Wrote:
(06-25-2014 06:05 PM)Katie Wasserman Wrote:  However, there are many third party devices that use the 82240A/B printer as an output device for their function. It's not just for calculators.

I'm interested to know more on third party devices that use the 82240 printer, can you give more information?
I know the HP Logicdart (I'm happy to have one) mentioned by Tony.

We've discussed this in the past, here's the first one I found. In some (most?) cases the printer is re-branded to match the company's main product.

battery tester

gas analyzer

While both of these loos slightly different from the HP branded 82240B the specs (for the gas analyzer printer at least) say it uses the HP 82240B format. I don't know if HP licensed the IP to build these to another company or if they actually manufactured them in a different enclosures.

Do an image search on "ir thermal printer" and you'll find other slightly different enclosures that too are likely 82240B format printers.

-katie

06-27-2014, 07:04 AM
Post: #18
 Martin Hepperle Member Posts: 221 Joined: May 2014
RE: Calculators with Support of the 82240 IR-Printer
(06-26-2014 10:44 PM)walter b Wrote:
(06-26-2014 06:27 PM)Marcus von Cube Wrote:  You can configure printing with the pMODE command (replace p by the printer symbol).

See the manual, p. 130 of v3.2 or p. 117 of v3.1.

d:-)

Ah, yes - if I only had paid attention at school when they explained how to RTFM. I had found this only after looking at the WP34S source code where I fould the printing flags (text, large font, small font). Great, so I can now also use the WP34S to control a nuclear power plant via wireless. I hope this is covered by the product's warranty.
06-27-2014, 07:07 AM
Post: #19
 walter b On Vacation Posts: 1,957 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-27-2014 07:04 AM)Martin Hepperle Wrote:  Great, so I can now also use the WP34S to control a nuclear power plant via wireless. I hope this is covered by the product's warranty.

Which warranty?
06-27-2014, 07:15 AM
Post: #20
 J-F Garnier Senior Member Posts: 338 Joined: Dec 2013
RE: Calculators with Support of the 82240 IR-Printer
(06-27-2014 02:43 AM)Katie Wasserman Wrote:  We've discussed this in the past, here's the first one I found. In some (most?) cases the printer is re-branded to match the company's main product.