Calculators with Support of the 82240 IR-Printer
|
06-27-2014, 07:25 AM
(This post was last modified: 06-27-2014 07:45 AM by Martin Hepperle.)
Post: #21
|
|||
|
|||
RE: Calculators with Support of the 82240 IR-Printer
(06-26-2014 10:08 PM)everettr Wrote: 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. 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. Emitting special escape sequences should be asy by sending e.g. an ESCape character (ASCII 27) and then a code which is not used by the printer and does not indicate a graphics sequence. For example "ESC 0" could initiate and terminate a different command mode and this could be filtered out of the IR stream so that the command is not sent to the printer. I have made provision for such a thing in the code, but it is more of a hook and not yet fully developed. I think most of the better calculators can send individual characters/ASCII codes. If the calculator can only emit simple thinkgs, one couls us a magic work (number or string) to switch modes, but that should be the last resort. Code may be posted here when polishing is finished. Martin |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)