Outline

From Bare Metal micro:bit
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Part 1: Machine code programming

The first third of the book is about programming at the machine level: instructions, how they are implemented by a computer, and how they can be combined to carry out familiar programming tasks.

  • Introducing the micro:bit.
  • Experiment 1 – Building a program. Check you can build and upload a simple program (written in pure C) that echoes lines typed on the terminal.
  • Experiment 2 – Machine instructions. Investigate the effect of single machine instructions using an interactive program.
  • Experiment 3 – Loops. Write programs for multiplication and division that contain loops.
  • Experiment 4 – Numbers. Explore number representations and conditional branches.
  • Experiment 5 – Subroutines. Learn how to define and call subroutines to give structure to a larger program.
  • Experiment 6 – Memory and arrays. Exploit instructions that load and store data in RAM.
  • Experiment 7 – A buffer overrun attack. Build a working (but harmless) model of a computer virus.

Part 2: Input/output devices

This part of the book is about programming I/O devices: how input and output happens by reading and writing device registers, and how we can use interrupts to make the computer respond to events.

  • Experiment 8 – Digital input/output. Use device registers to control I/O pins and light LEDs.
  • Experiment 9 – Pure assembly language. Flash an LED with a minimal program written in assembly language.
  • Experiment 10 – Serial communication. Use a serial device to transmit characters.
  • Experiment 11 – Interrupts for I/O. Control the serial device with interrupts to free the processor.
  • Experiment 12 – Interrupt mechanism. Plot gaps in a waveform to measure the time needed to handle interrupts.
  • Experiment 13 – Neopixels. Use assembly language to make a bit-banged implementation of the protocol for WS2812 'NeoPixel' LEDs.

Part 3: An embedded operating system

The last third of the book introduces micro:bian, a tiny embedded operating system based on message passing, and uses it to organise programs that contain multiple processes interleaved with each other.

  • Introducing micro:bian.
  • Experiment 14 – Processes. Use micro:bian processes to perform multiple tasks concurrently.
  • Experiment 15 – Messages. Use messages to communicate between processes.
  • Experiment 16 – Synchronisation. Synchronise the actions of multiple processes by making them exchange messages.
  • Experiment 17 – Device drivers. Manage I/O devices using driver processes that receive interrupts as messages.
  • Experiment 18 – I2C-based spirit level. Access the micro:bit accelerometer over the I2C bus to make a 2D spirit level.
  • Experiment 19 – Servo motors. Use a timer to generate the signals needed to control servo motors.
  • Experiment 20 – Radio. Communicate between multiple micro:bits using the in-built radio.
  • Experiment 21 – Remote-controlled car. Use servos and radio to make a remote-controlled car.

Appendices