Skip to main content

Subsection 1.1.1 What Is a Microcontroller?

A microcontroller is a self-contained computer on a single chip. Unlike the processor in your laptop, which is just a CPU that relies on separate chips for memory, storage, and input/output, a microcontroller integrates all of those components into one package: a CPU core, flash memory for your program, RAM for variables, and a collection of hardware peripherals (timers, communication interfaces, analog-to-digital converters, and more).
The design philosophy is different too. A laptop processor is optimized for running a general-purpose operating system and many programs at once. A microcontroller is optimized for running one dedicated task with precise timing, low power consumption, and direct control of external hardware. It starts executing your program the instant power is applied and never stops. There is no operating system to boot, no file system to mount, no display driver to load: just your code and the hardware.
The microcontroller we use in ENGS 28 is the STM32C031C6, made by STMicroelectronics. It contains a 32-bit Arm Cortex-M0+ processor core, 32 KB of flash memory, 12 KB of RAM, and a set of peripherals, all in a package smaller than a postage stamp. It runs at 12 MHz by default, draws a few milliamps, and costs less than a dollar in volume.