AVR Board
AVR  arduino  atmel  board  code  core  data  design  development  device  features  flash  memory  USB  registers  microcontroller  power  program  programming  software 

Microcontroller Basics



It is impossible to imagine modern electronics without microcontrollers. What used to be done with combinational or sequential logic is now done with a single IC that runs a program that does exactly what we want it to do. Or perhaps more accurately: should do exactly what we want it to do.

Particularly during the early development phase of the hardware and software, we often run into perplexing problems. The most frustrating of these is when the microcontroller doesn't do anything at all (or appears not to do anything at all). With older microcontrollers that have external program memory an oscilloscope or logic probe could often give an answer. A measurement on the address or data bus would give a quick indication whether the microcontroller was "awake" or not. But these days all memory is integrated in the IC, in most cases, so only the I/O ports can sometimes provide consolation as to an indication of any sign of life.

Fortunately (?) most controllers still have an external oscillator, so that we at least can check whether the clock is running. However, even this option isn’t available with many small microcontrollers that have an internal oscillator.

The simplest method to ensure that the oscillator is running and that the software, in principle, should be able to work, is to insert a short routine at the beginning of the program that toggles one of the port pins a few times. Preferably a port pin that has an LED connected to it, that gives immediate visual feedback and an oscilloscope is not required. Don’t make the program wait for some external action (such as a button press, reception of data via the serial link, etc.), but just do ‘something’ on any pin whatsoever. If there is still no indication of any activity (and assuming that very basic checks like measuring the power supply and whether the reset line is at the desired level have already been done), there is a chance of ten to one that something has gone wrong during programming. The configuration fuses of the microcontroller are the main suspects.

Modern microcontrollers have a number of bits (fuses) that define the behavior of the IC. In the scope of this article we first have to look at the settings, if there are any, for the oscillator (internal/external, frequency range). If these settings are wrong then in most cases nothing happens at all. The second suspect is — if present — the watchdog timer (WTD). If this has been turned on when programming and the application does not reset the timer, the microcontroller will repeatedly be reset and often won’t even reach the actual program.

Number three is the setting for the reset circuit. For example, the reset signal for some microcontrollers can be selected to be internal or external. Consult the datasheet for the controller and check the remainder of the circuit to determine the correct settings. It can sometimes take a bit of looking around in the programmer software to find where these settings are hidden — as we already discussed in an earlier story — sometimes they have different names than what you would expect. In final desperation you could try all possible combinations of the fuses in the hope that one of them works. This sounds very awkward, but it will unfortunately be necessary at some point! Fortunately, reprogramming of a microcontroller is not such a time consuming job these days.

A simple start-up indication built into the application saves a lot of time and frustration — at this point you know that the hardware is functioning and that nothing went wrong when programming the memory and fuses. At a later stage of development, you could remove the start-up routine, but only do that if absolutely necessary.



A resistor is a perhaps the most common building block used in circuits. Resistors come in many shapes and sizes this tool is used to decode information for color banded axial lead resistors. You can use Resistor Calculator to calculate the resistance of a 4 band resistors.