Bascom and AVR, Teletron TE704 external control

The Teletron TE704 is a beautifully engineered shortwave receiver. It was designed to be used as a receiver in combination with a weather fax machine. As such, it has a front-panel with a set of seven switches for setting the frequency in 10Hz resolution. This is suitable for a stationary setup, but quite awkward when you want to 'tune' accross a band.
I therefore made an external control unit which can be connected to a 37-pin connector on the back of the receiver:

This connector has seperate pins to control all receive frequency digits, grouped as binary coded decimals (BCD):
 10MHz digit, bit 1
 10MHz digit, bit 2
  1MHz digit, bit 1
  1MHz digit, bit 2
  1MHz digit, bit 4
  1MHz digit, bit 8
100kHz digit, bit 1
100kHz digit, bit 2
100kHz digit, bit 4
100kHz digit, bit 8
 10kHz digit, bit 1
 10kHz digit, bit 2
 10kHz digit, bit 4
 10kHz digit, bit 8
  1kHz digit, bit 1
  1kHz digit, bit 2
  1kHz digit, bit 4
  1kHz digit, bit 8
 100Hz digit, bit 1
 100Hz digit, bit 2
 100Hz digit, bit 4
 100Hz digit, bit 8
  10Hz digit, bit 1
  10Hz digit, bit 2
  10Hz digit, bit 4
  10Hz digit, bit 8
The external controller uses an ATMega8 and five Philips PCF8574AN eight-bit I2C I/O expanders. One of the PCF8574's is used to read a 4x4 keyboard. It has its INT output pin connected to the ATMega8 Int1 input. Its I2C address is set to 100b.
Four PCF8574's are used to switch the seven frequency digit BCD outputs. They use I2C addresses 000b, 001b, 010b and 011b.

The program is not too complex, most of the work is in reading the 4x4 keyboard and constructing a valid frequency string from the keyboard input.
The following keys have special functions:
C: menu (key A: scan frequency up, key B: scan frequency down in 10Hz steps)
D: decimal point
*: escape
#: enter

Another, but much more sophisticated, example of homebrew digital receiver control is the WJ8888/B2 25kHz Synchronous Optocoupler Remote Control Interface built by Peter and Geert De Coninck. They used an AT90S8535 controlller programmed in Bascom. Make sure you read their very detailed description of how they developed and built this interface and managed, in the process, to bring new features to the WJ8888 receiver control.