Microcontroller topics to master

From DP

Jump to: navigation , search


Hello world

In the software programming world, the time-honoured "hello world" program is where you start. When learning to use microcontrollers, the equivalent is the "flashing LED" program and circuit. If you can flash a LED, then you're on your way.

Flashing a LED is also a good diagnostic circuit. It is always best to at least flash a LED first, before building a complicated circuit only to find that nothing seems to work and not knowing why or where to start to find out. If you can successfully flash a LED then you know:

  • you are supplying power to the microcontroller;
  • the oscillator (external crystal or resonator, or internal crystal or resonator) is running;
  • you have successfully loaded the firmware into the microcontroller;
  • the microcontroller is functioning;
  • the basic circuit works.

If you you can't flash a LED, then you know that one (or more) of the points above is where the problem lies in your very basic program and circuit. If that doesn't help, re-read the microcontroller datasheet and double check any errata for known silicon issues. Still stuck? Ask for help in an appropriate forum (provide all relevant details especially your code).

The hardware needed for a circuit to flash a LED is fairly simple:

  • a microcontroller chip;
  • an external crystal/resonator, if not using an internal one;
  • an LED;
  • a current limiting resistor for the LED;
  • a power supply;
  • a few ceramic decoupling capacitors;
  • a breadboard and wire;
  • a pre-programmed bootloader or a hardware programmer.

The software (aka firmware) simply sets a digital pin to output, turns that pin to which you have connected the LED on (high), waits a perceptible period of time and then turns the pin off (low), and repeats indefinitely. Never underestimate the joy that the spectacle of your first flashing LED can bring!

Once you have mastered the flashing LED, you can move on to the more advanced topics below.



  • Read the datasheet, reference manual and any errata for your microcontroller (required for everything)
  • Pins/port/direction (LED flashing)
  • PWM (LED intensity)


  • UART communication (when and how to use max232 chip)
  • SPI communication
  • I2C communication
  • CAN communication
  • USB communication
  • Interrupts (pin - detect button press, UART - communication)
  • Hardware timers
  • Interfacing an HD44870 display
  • Analog-Digital Conversion (ADC)
  • Digital-Analog Conversion (DAC)
  • EEPROM (store stuff)
  • Sleep/low power (battery operation)
  • Bootloaders (memory map, self-writing)

Broad concepts

  • Multiplexing (timers, pins)