Post Reply 
Calculators with Support of the 82240 IR-Printer
06-27-2014, 03:54 PM
Post: #26
RE: Calculators with Support of the 82240 IR-Printer
(06-27-2014 07:25 AM)Martin Hepperle Wrote:  Yes, I used a pin-low interrupt to capture the start of a data frame and then a timer interrupt to capture the half-bits. Before that I had tried the quick&dirty approach (polling with while() loops) but that was unreliable, inelegant and dirty.
The other problem was that I first had the serial communication in the interrupt service routines (resp. in the polling loops) but I quickly learned that serial I/O is too slow so that I lost bits and sync. Therefore I implemented a ring buffer (mailslot) where the interrupt routine places the decoded and error checked byte and the main loop later emits these to the serial line. This works very well (i would even dare to say perfectly) and I noticed that I could make the buffer very small (1-2 bytes), but stuck with a voluptuous 8-16 byte buffer.
My error checking corrects one flipped bit and I think this could be improved, but I am not sure.

I wrote the REDEYE receiver code three times. The 1st version in 8086 assember for a Messdos PC. The signal from a IR-receiver was connected to the CTS line of a RS232C interface. The input of the program was interrupt driven by the CTS line interrupt. The last version used the PC timer chip to decode the input signal.

The 2nd version I wrote more a less parallel in 8051 assembler for a company. IR input interrupt driven, internal timer to decode the framing and a timer interrupt for the case the frame was incomplete with less than 2 bis missing.

The 3rd version is implemented in C and published under the GPL v2 inside Emu28 and Emu42 (file REDEYE.C). The implementation is also "interrupt driven". At every rising edge of the IR output pin the decoder is called. The timing is generated over the elapsed CPU cycles which is in reality the elaped time since the last IR signal rising edge. The implementation of the error correction is complete, in fact it can restore two missed bits. Read the originally HP documentation (HP 82240B Technical Interfacing Guide and Hewlett Packard Journal October 1987 page 16) carefully please, especially the concept about "missed bits" at IR bursts and drop outs in the Hewlett Packard Journal article. This is very important for the error correction. IMHO the Journal article gives more practical hints for a software implementation then the Technical Interfacing Guide.

I agree with the ring buffer solution for the captured character. The IR input interrupt had highest priority in my 8051 implementation. On another thing I recognized that we now have 2014, the original 8051 program design was made in 1993, the latest version was from 2002 and the firmware binary for the 8051 had a size of 676 bytes! Sorry, I'm not able to publish this firmware.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Calculators with Support of the 82240 IR-Printer - Christoph Giesselink - 06-27-2014 03:54 PM



User(s) browsing this thread: 6 Guest(s)