Before we get too involved with the detail, let's start by asking this basic question:

What is a Microcontroller?

Microcontrollers are used in many items of electronic equipment. They are not a new invention - back in the late 1970s and early '80s there was a "digital revolution" in the consumer electronics market which fuelled their growth. For example, CD players required intelligent microprocessor control, and increasingly television sets were sold with remote control, digital tuning systems and teletext decoders. Mechanical "piano-key" controls seen on early domestic video recorders were replaced with "soft-touch" buttons.

While they have a very strong presence in the consumer market, they are also seen in professional broadcasting and industrial environments. Current microcontrollers are extremely powerful, and can run complex "real-time" applications that are able to multi-task many different hardware functions while providing a nice user-interface for the operator.

The Microchip "PIC" family is a good range of microcontrollers to study. They are not too difficult for a beginner to learn, yet they are powerful enough to be genuinely useful. You'll find that you can replace complicated logic functions that require many standard TTL or CMOS logic ICs with just one PIC. Or, using just that one PIC, you could implement something that is easily beyond the capability of TTL logic.

Real-world example - FM tuner

Starting at the very beginning, it is worth considering the difference between a microprocessor and a microcontroller. Consider the following example.

Block diagram of an FM tuner (12K)

This diagram shows the analogue signal path in a typical FM tuner - you might recognise most of the components shown here. But, most importantly, note the control connections that are required between the analogue hardware and the control circuitry.

The phase-locked-loop (PLL) is controlled in this example by a two-wire serial control bus. There are different standards in use, but one of the most common standards is called I2C (this stands for Inter-IC bus - a standard invented by Philips some 20 years ago)

This particular PLL IC happens to have a TTL-compatible output to indicate if the PLL is locked and therefore "happy". This is the easiest way to transfer "status" information or commands from one piece of hardware to another, but in a more complex system this could be inefficient. Remember, the signals will require PCB space, cable and connectors.

In this example we have another 3 TTL-compatible signals:

  • A signal from the stereo decoder to inform the control system when we are receiving a stereo broadcast.
  • A signal from the control system to tell the stereo decoder to operate in mono or stereo mode.
  • A signal to mute the audio outputs (this would be used while tuning or during no-signal conditions to prevent unwanted noises being heard).

Finally, there is an analogue voltage from the FM demodulator which is used to provide a Received Signal Strength Indication (R.S.S.I.). This is used to provide a front panel display of the signal strength, and also to enable station-search operations. Obviously, this analogue voltage needs to be converted to digital using an ADC (analogue to digital converter) before the control system can use it.

Here's the required control hardware:

Control hardware required for the FM

If you have studied computing systems in the past, you might recognise the major blocks here. While the CPU is the heart of the system, in order to function it requires RAM, ROM and memory-mapped IO. The programme code required to make this otherwise useless collection of hardware act as an FM tuner is stored within the ROM, and the RAM contains all the variables needed to perform this task - such as the current frequency.

The latter block, which could be formed with standard logic, is used to "translate" an address in memory to physical IO lines on the circuit board. So, for example, to check the state of the "PLL LOCKED" signal, the software will just read a particular memory location. To the CPU this looks no different to any address in the memory-map. But in reality, the memory-mapped IO will translate this to a "real" signal.

In addition to the four IO lines from the analogue circuitry, the memory-mapped IO provides "connectivity" to a number of different parts of the system: the ADC, I2C interface, the EEPROM memory (which might store your preset radio stations) and the user-interface formed by the keypad and display. In short, the memory-mapped IO forms a large part of the hardware in a typical microcontroller system.

Finally, you'll notice some peripheral circuitry - the clock oscillator and reset generators should be familiar building blocks. The infra-red remote control signal is decoded with the help of an interrupt because of the precise timing requirements.

This is a large and complicated piece of hardware, which once upon a time required a lot of ICs and other components to implement. You won't see all that when you remove the lid on your hi-fi tuner. Instead, you will most likely see one large IC, which connects directly to the display, front panel controls and the analogue sections of the tuner. All of the blocks above can be integrated into one chip, and that IC is called a microcontroller.

Control hardware using a microcontroller (14K)