It was thus said that the Great Jim once stated:
When I first broached the idea of making my palmtop talk to a PC JR keyboard,
someone on this list mentioned they knew where to find the keyboard codes the
Peanut keyboard generates. Since I've had no luck finding this data in web
searches, could that someone please let me know where to find this info?
I have the IBM PCjr Technical Reference Manual here (at home). Here's the
relevent data from it (only the more important stuff):
INFRA-RED RECEIVER
...
Functional Description
... During keyboard operation, the emitted light
is modulated, transmitted, and received in the following
sequence:
1. A key is pushed.
2. The data stream is sent using the infra-red emitting
diodes
3. The receiver amplifies and processes the signal.
4. The demodulated signal is sent to the system board.
The signal received consists of an infra-red-light
transmission modulated at 40 kHz.
Application Notes
The Infra-Red Receiver Board can serve as a
general-purpose infra-red-receiver, however, the
demodulator timings are tailored to the needs of the
system.
Programming Considerations
The serially-encoded word is software de-serialized by
the 8088 processor on the system unit. The leading
edge of the start bit will generate a non-maskable
interrupt (NMI). Once the processor enters the NMI
routine to handle the deserialization, the keyboard-data
line is sampled and the processor waits to sample the
trailing edge of the start bit. When the trailing edge of
the start bit is sampled, the processor will wait for 310
uS and sample the first half of the first data bit. This
delay causes the processor to sample in the nominal
center of the first half of the first data bit. The
processor then samples the keyboard data every half-
bit cell-time. The sampling interval is 220 uS. The
processor samples each half-bit-sample 5 times and will
determine the logical level of the sample by majority
rule. This enables the processor to discrimitate against
transient glitches and to filter out noise. The 8088
processor ultilizes one 8255 PPI bit (PORT C BIT 6)
and shares one 8253 timer channel (CHANNEL 1) to
do the software de-serialization of the keyboard data.
...
Infra-Red connector Specifications
Pin Signal Input/Output
A01 +12V input
A02 Ground input
A03 Ground-shield input
A04 I.R. TEST FREQ. input
B01 Ground input
B02 +5V input
B03 -I.R. TEST FRQ output
B04 Ground input
IBM PCjr CORDLESS KEYBOARD
... Power is
sent to the keyboard and serially-encoded data received
by the system unit through the optional cord. When
connected, the cord's keyboard connector removes the
battery power and the -CABLE CONNECT signal
disables the infra-red-receiver circuit. The disabling of
the circuit also allows other infrared devices to be used
without interfering with the system. The data which is
received through the IR link or by the cord, have the
same format.
...
Transmitter
Serially encoded words are transmitted to the system
unit using the Infra-Red Link or the cable link. Encoded
words are sent to the system unit with odd parity. Both
the Infra-Red Link and the cable link use biphase
serial-encoding and each is a simplex link.
The 80C48 microprocessor does the biphase serial
encoding with a bit cell of 440 uS. A biphase
logically-encoded 1 is transmitted as logical 1 for the
first half of the bit cell time and as a logical 0 for the
second half of the bit cell. A bitphase logically-encoded
0 is transmitted as a logical 0 for the first half of the bit
cell time and as a logical 1 for the second half of the bit
cell.
Each logical 1 transmission for the Infra-Red Link
consists of a 40 kHz carrier burst at a 50% duty cycle.
First bit Start Bit
Second bit Data Bit 0 (Least Significant Bit)
Third bit Data Bit 1
...
Ninth bit Data bit 7 (Most Significant Bit)
Tenth bit Parity Bit
Eleventh bit Stop Bit
Eleven stop bits are inserted after every scan-code
transmission. This is to allow some processor
bandwidth between keystrokes to honor other types of
interrupts, such as serial and time-of-day.
Cable:
| biphase 1 | | biphase 0 |
----+ +---------- -----------+ +----------
| | | |
+------+ +------+
| Bit cell | | Bit Cell |
->| 220uS|<- | | ->| 220uS|<-
->| 440 uS |<- ->| 440 uS |<-
Infra-Red
| biphase 1 | | biphase 1 |
----+WW+------------- -----------+WW+---------------------
|WW| 40 kHz |WW| 40 kHz
+WW+ @ 50% duty cycle +WW+ @ 50% duty Cycle
| | | ->|220uS |<-
->| |<-62.5uS | | ->| |<-| 62.5uS
->| 440uS |<- ->| 440uS |
The scancodes the application program receives via INT 16h (or even from
INT 09h) are compatible with the original IBM PC 83-key keyboard (to
maintain compatibility). The NMI routine decodes the serial stream, then
calls INT 48h with the scan code in AL to concert the 62-key code to the
83-key code, which it stores into port 60h, then calls INT 09h.
Unfortunately, the tech ref is quite vague on what keys return which scan
codes, so you may have to actually play with INT 48h to see the actual
codes. The BIOS listing is less than clear 8-)
-spc (I would recomend getting IBM Technical Reference Part #6322963)