Introduction to Microcontroller
Programming
Fundamentals of Embedded Systems and Architecture | Technical Design Lab
1. Introduction to Embedded Hardware
An embedded system integrates a microcontroller unit (MCU) with dedicated hardware peripherals to
execute targeted real-time tasks. Core components within a typical microcontroller architecture include:
Central Processing Unit (CPU) Executes compiled instructions and performs arithmetic/logic
calculations.
Volatile Memory (RAM) Provides fast read/write storage for temporary program state and
variables.
Non-Volatile Memory (Flash/EEPROM) Stores firmware code and persistent configuration
parameters.
General Purpose Input/Output (GPIO) Pins configured as digital inputs or outputs to interface with
external circuitry.
2. Hardware Communication Protocols
Microcontrollers interact with external sensors, displays, and coprocessors through standard
synchronous and asynchronous communication protocols:
I2C (Inter-Integrated Circuit) A multi-master, multi-slave two-wire serial protocol using Serial Data
(SDA) and Serial Clock (SCL) lines.
SPI (Serial Peripheral Interface) A high-speed, full-duplex four-wire bus utilizing Master Out Slave In
(MOSI), Master In Slave Out (MISO), Serial Clock (SCK), and Chip Select (CS).
UART (Universal Asynchronous Receiver-Transmitter) A simple point-to-point asynchronous link
relying on dedicated transmit (TX) and receive (RX) lines with matching baud rates.
3. Interrupt Handling and Timers
Interrupts enable hardware peripherals to pause main code execution instantly in response to
asynchronous external events, ensuring low-latency processing compared to polling. Hardware
timer/counter modules generate precise pulse-width modulation (PWM) outputs and trigger periodic
tasks.