Bascom and AVR, Control a Philips FI1216 tuner

A small AVR program to control a Philips FI1216 tuner . The main purpose being to extract the internal VCO signal (using a small pickup loop near the VCO).
A PCF8574 eight-bit I/O expander is used to read seven buttons:
- Fup : increases VCO frequency
- Fdn : decreases VCO frequency
- Stup: increases frequency step value
- STdn: decreases frequency step value
- Mem : cycles through three memories
- Sto : stores current VCO frequency in current memory
- Rcl : recalls current memory frequency to VCO
Although I have defined only three memories, you can easily modify the program to use more.
If the ATMega8 is powered up while one one the buttons is pressed, three default frequencies are written to the threee memories: 200, 250 and 300MHz. You MUST perform this initial action at least once otherwise the VCO frequencies are undefined!
The FI1216 VCO's minimal step frequency is 50kHz. By using the Fstup and Fstdn buttons, the frequency step can selected from the series: 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10MHz.
The LCD shows the current VCO frequency and frequency step on the first line. PLL locking is indicated using the "L" character at the end of the first line. If after a certain number of retries, the PLL does not show a lock condition, the "N" character is shown.
The second line shows the current memory content. If the Mem button is pressed, the memory number is cycled through the numbers 1, 2 and 3. The current VCO frequency shown on the first line can be stored in the current memory shown on the second line using the Sto button. Also, the content of the current memory can be recalled using the Rcl button and sent to the VCO.

The schematic:

shows the ATMega8 with the I/O expander, the LCD and the FI1216 tuner. I started out with an AT90S2313, hence the I/O expander. The AT90S2313 proved to be just a bit too small to contain the
program , so I used an ATMega8. If you want, you can omit the I/O expander and use the free pins on the ATMega8 to read the buttons.

The FI1216 can also be controlled using a PC with a simple QBASIC program.