Source code for the three display and control boards is available via the following links:
All source code was compiled using the Microchip MPLAB IDE, and the PIC18F45K22 devices programmed using Microchip PICkit 3.
The Main Display & Control Board source code consists of the following files:
system.h – contains function prototypes, PIC18F I/O pin definitions, PIC18F EEPROM memory allocations, band edge limits, I2C address for the various boards, and various defines and structures.
Initialization.c – first routine called by main.c upon system power up. Initializes PIC18F I/O Port, I2C and Interrupt operation. Reads data from EEPROM to initialize Memories, Last Band Data arrays, and start up band, frequency, mode & etc. Last Band Data arrays store the frequency and mode information from the last time VFO A and B visited a given band. If this is a new board or PIC18F, default values are loaded into EEPROM. Relay Boards and the Right Display & Contol Board are initialized to the start up state.
main.c – calls initialization routines described above, calls the LCD initialization routine which includes a splash sceen, then calls the VFO initialization routine, and finally the Right Display & Control Board initialization routine.
A while(1) loop continuously executes the following functions:
- Reads RF Attenuator and RF Pre-amp settings from the Right Display & Control Board RF Gain optical shaft encoder and drives Relay Boards accordingly.
- Gets an S-Meter reading from the IF Board and sends this to the Left Display & Control Board.
- Updates main tuning frequency if the FreqUpdateFlag is set.
- Scans the Keypad Board for button presses and call Keyboard.c routines if button is pressed.
- Updates the Memory Display timer if a memory function has been selected. The timer turns off the Memory Display approximately 30 seconds after the last time a memory function was accessed.
In addition, main.c includes the high priority interrupt routine for the Main Tuning Dial on the Express Receiver. I borrowed this code substanially from Jim Veatch WA2EUJ, “The DSP-610 Transceiver,” QST pp. 30, AUG, 2012. This implementation is very effective in providing a smooth tuning action.
LCD.c – LCD related functions. The main LCD function is LCD_Freq_Disp_Update which updates the Main Tuning displays for VFO A and B. Other functions include, memory display handling, and handling of displays for each of the available Functions. LCD utility routines are also included in LCD.c
VFO.c – VFO related functions. Includes the VFO initialization routine called from main.c which sets the Si570 Local Oscillator frequency, initializes VFO A and VFO B start frequencies, and selects VFO A as the start up VFO. VFO_Freq_Update takes care of band change housekeeping, including storing the last band frequency and mode, and updating band and mode information on the Right Display for the new band; this is done for VFO A and VFO B depending on which VFO is active. Prior to calling the Si570 functions to update the VFO frequency, VFO_Freq_Update checks the requested frequency is within limits for the selected band.
More to come…