It was decided to use only 4 push-buttons (+1, +10, -1, -10) as
in the envisaged application other functions such as Auto and Standby should
really be made from the cockpit. These can conveniently be hooked
up to Port B bits 4-7 which also have internal pull-ups, so no additional
components besides the push-buttons are required.
A circuit diagram is provided here.
The switch detect and debounce software is pretty basic.
The software checks for changes in the status of the port by comparing its
present value with that previously read. A delay is added by counting
256 "ticks" of the 4800 baud timer (approximately 40ms). The four
bits are then checked one by one and the appropriate code sent to the transmit
routine.
The routine has some shortcomings. If two switches are
pressed simultaneously, the last (in scan order) is recognised. If
a second switch is pressed while another is held down, then its code may
or may not be sent depending on whether it is scanned before or after the
first switch. Thus, the convenient "tack" command on the autopilot is not available in this version of the remote control.