Programming microcontrollers

In order for microcontrollers to work correctly they must be programmed. This can be achieved using a wide range of software, hardware and different programming languages.

Programming methods

Microcontrollers can be programmed using a range of different methods. These include:

Each have their own advantages and disadvantages:

curriculum-key-fact
Text-based languages add more flexibility but are harder to understand and use. Block-based editors are simple to use but can be limiting if complex programs need to be written. Flowcharts are simple and easy to read but there can be bugs in the system.
Using block-based editing to code a simple timer - when button A is pressed the counter adds one.
Example of block-based editing

Example of a flowchart program

The program below acts as a simple timer. When an input pin detects a high (on) signal, it turns an output on for twenty seconds. Software such as PICAXE Editor, GENIE and Yenka can be used for writing flowchart programs.

An example flowchart program of a simple timer. When an input pin detects a high signal, it turns an output on for twenty seconds.Flowchart programme of a simple timer

Downloading a program

Once written and tested, the program must be downloaded onto the microcontroller. Many systems support ‘in-circuit’ programming. This means the microcontroller does not have to be removed from the circuit to be programmed. For some systems, the chip may have to be taken from the circuit and placed in a special downloader. A serial or USB cable is commonly used to download the program.

Question

Describe what is meant by ‘in-circuit’ programming.

The microcontroller is programmed without removing it from the circuit.