The REDEYE printer requires 15-bit frames of a precise format. Each bit of the frame consists of two half-bits. The duration of each half-bit is 14 cycles of the 32768 kHz crystal oscillator. The half-bit is considered to be "on" if the LED is pulsed 6-8 times (out of the 14 possible) at the 32768 kHz rate. Hornet's REDEYE port uses 8 pulses. The format of a complete REDEYE frame is shown below:
Start-bits Three half-bits "on-on-on"
Hamming-bits Four pairs of half-bits
Data-bits Eight pairs of half-bits
Each of the four hamming and eight data bits are encoded with two
half-bits. A "one" data or hamming bit is encoded by "on-off"
and a zero is encoded by "off-on".
Stop-bits Three half-bits "off-off-off"
This is the minimum idle time required between frames.
The ELBE, RED, LBF, and LBR bits are cleared at reset. The REDEYE port also uses a formatter which is turned off whenever RED is cleared. Software initiates a half-bit transmission by writing a bit to LBR. This automatically sets the LBF flags in IRFMAT register and starts the state machine. The state machine transfers the bit from LBR into the formatter and clears LBF. If ELBE is set, this will cause an IR interrupt indicating that it is safe to write the next half-bit to LBR. The state machine then times the half-bit for 14 counts of the 32768 Hz crystal oscillator. If the bit in the formatter is a one, the LED is pulsed for the first eight of the 14 counts. Otherwise the LED is left off. If after the 14 counts LBF is clear, the state machine will return to its idle state of waiting for LBF. Otherwise it will immediately transfer the next half-bit and start timing it.
When LBF is clear and ELBE is set, an IR interrupt will occur. When the state machine clears LBF, software has 13 counts of the oscillator to write the next bit to LBR. Otherwise the length of the half-bits will not be correct.
Through-put:
32768 /28 = 1170.3 bps (bits/sec)