Hi Ian, >Similar information about the Q40 keyboard port would be useful too.
The input is a 6 pin DIN connector. Almost every keyboard has a leaflet to describe the pinout, so I don't repeat it here. The Q40/Q60 keyboard transmission protocol is clocked serial (with the keyboard as clock source), 11 bits in length. One start bit (logic 0), 8 data bits (LSB first), one odd parity bit and a stop bit (logic 1). The clock rate is about 10-20 KHz and can vary from keyboard to keyboard. The keyboard data format is similar to 8-odd-1 asynchronous transmission format. However, the bit rate from keyboard to keyboard can vary significantly so it is necessary to use a clocked serial interface with a receive clock input. The Q40/Q60 LSI logic reads the data bits on the falling "edge" of each clock pulse. The exact timing and analogue rise/fall behaviour is very tricky and not well defined. I had to use things like digital oversampling to support a wide range of keyboards. Both CLOCK and DATA lines are implemented on the keyboard end as open-collector outputs with pull-up resistors to +5V. The PC keyboard interface is fairly nasty to implement. The problem with the PC keyboard is that it uses the PC's on-board Intel 8741 (or equivalent) single-chip microprocessor and the only way to exactly reproduce its behaviour is to use the same chip. AFAIK the 8741 is still implemented as part of new PCs, within the PC chipset. Of course, I wanted no Intel chips on the Q40 ;-) Hope this was useful for you. Peter