The Microcontroller Units

The pre amplifier is fully controlled by a digital interface. This digital control is built around a micro controller unit (MCU) from Microchip (PIC series).This chip has Flash program memory and features EEPROM for storing data after power down. This chip controls all settings of volume, balance and input selection and controls a display to show the status of the amplifier. 

MCU block diagram

The block diagram of this digital part of the amplifier is simple but efficient. From switches on the front of the amplifier volume and balance settings are processed by the MCU and serially shifted into the prographoto of MCU unit including volume chip, click to see an enlarged viewmmable gain amplifier circuit for setting the correponding analog gain. Input selection is also controlled in an analogous manner. 
To show the user the corresponding results, a display is placed in the front. The MCU controls this display in a 4 bit mode using a serial interface in combination with an IO expander (I2C interface). The display shows welcome messages and displays the setting of input selection and volume/balance settings. The input selection is decoded with 2 bits. The mute function is implemented on the MCU although this can also be done on the amplifier chip itself.

block_mcu.gif (18196 bytes)

To ease further control of the amplifier a remote control is added. The IR transmitter is build around a similar kind of processor and sends key codes to the preamplifer MCU which, in turn, are decoded. The transmitter is in standby mode unless a key is pressed to save battery power.
block_remote.gif (10894 bytes)


For the MCU to work a program is required. This program is written in C using a PIC C-compiler and creates a HEX file. This HEX file is downloaded to the chip. The C-code is written in MPLAB which can be downloaded from the Microchip site. An other C or C++ editor can also be used for creating the code but this PIC C-compiler can be integrated into MPLAB and interpretes PIC instructions.
The program uses an interrupt service routine (ISR) to read any user interaction. After an interrupt, new volume settings are written to the amplifier ciruitry and the display is updated. If there is no activity on the switches, no updates will be send to the amplifier chip to reduce high frequency noise.
For storing key variables the C-code is combined with assembly routines for reading and writing data from/to EEPROM.

Source: initial C-program code by E van de Logt

Downloading program code

From compilation, a HEX file is created. Using PIC programming software, this HEX file can be downloaded to the chip. Here, the serial port of the PC is used for connection but parallel ports can be used as well. Programming time is around 15 seconds for the main MCU program. To program the chip a relatively high voltage (in this case 13V) is required on the Masterclear (MCLR) pin. This voltage enables the Fowler-Nordheim tunneling which makes it possible to store program code in the chip in a non-volatile way. This Fowler-Nordheim tunneling is the traditional way to store bit values in memory cells although for Flash memory lower voltages will also do. Most devices also incorporates low voltage programming but this requires an additonal IO pin for programming purposes. Programming is done either in-circuit or in a programmer. This last option is used here.
To equalize levels for serial data transfer between the PIC and the PC some voltage conversion (using transistors) is needed. This can be done by soldering a small PCB which serves as the hardware for the programmer. Software for downloading the HEX file can be found on the internet.


More on this Topic


Active filters and speaker combinations are matched. 
More on speakers ...

software flow
The MCU embedded code is defined with MPLAB IDE.
More on embedded software ...

Also in this section