Microcontroller programming

Putting instructions inside a microcontroller

In the world of microcontrollers, most communications happens over what is called “Bit-Serial connections”.

What is a bit? If you’re hazy on this, go back and read Serial Communications.

Think about telling someone your telephone number. We use ten symbols “0 1 2 3 4 5 6 7 8 9” to express our numbers. We might tell someone our phone number as “five five five four seven three one eight two two”. We call this a Decimal notation system, from the Latin word for Ten. We also call this “Base Ten” as we have ten symbols.

Computers only use two symbols, 0 and 1, which we call a Binary notation, or “Base Two” (more Latin again).

In our Decimal system, we use a Positional Notation to express numbers greater than ten. We arrange our symbols (which we call Digits, which is from the Latin for fingers) in columns.

The rightmost digit counts units, the next leftmost digit counts the number of multiples of our base (eg tens), the third digit is hundreds.

In computers we count in base-two, so we can signal a number using low voltage (0) or high voltage (1). Zero and One are the Binary Digits called bits for short.

We send numbers over wires by alternating between high and low voltage, this is a called an “Asynchronous Serial Link”.

Getting device drivers to connect to your microcontroller

Your microcontroller may have a number of pins dedicated to an asynchronous serial link, or it might have a USB port which converts to this asynchronous serial protocol.

If your microcontroller lacks a USB interface, you will need an external USB-to-serial converter.

In either case, the software you will need is the same. You will need an operating system device driver for whichever converter you have.

There are three commonly used converters, from differenct manufacturers

  • FTDI FT-232
  • SI Labs CP2102
  • CH340

(See links below)

Installing the Arduino development environment

The Arduino comes with an Integrated Development Environment (IDE) that includes an editor to help you write your programs, a compiler to check for errors and produce machine code, and software to Download your program into the microcontroller.

It is now possible to program an Arduino from a web site without needing to install the IDE locally (handy for students that have Chromebooks), but the IDE is more flexible than the web interface at time of writing.

You will need to Download the and instal lthe Arduino IDE from the link below. The IDE uses Java, so you may need to install Java separately.

If you are attending a workshop, check whether your Instructor has the software already downloaded to a portable memory drive for you to use.