Basic Embedded Systems

Basic Embedded Systems

Embedded systems are computer systems designed for a specific function inside a larger device.

Examples:

  • washing machine controller,
  • car ABS system,
  • microwave oven,
  • smart watch,
  • printer controller.

Embedded system characteristics

  • task-specific,
  • resource constrained,
  • often real-time,
  • reliable,
  • low power,
  • interacts with hardware sensors/actuators.

Microprocessor vs Microcontroller

Microprocessor Microcontroller
CPU only CPU + memory + I/O on one chip
Needs external RAM/ROM/peripherals Built-in peripherals
Used in PCs/general systems Used in embedded systems
Higher processing capability Lower cost/power

Sensor and actuator

Sensor: converts physical quantity to electrical signal.
Examples: temperature sensor, pressure sensor.

Actuator: converts electrical signal to physical action.
Examples: motor, relay, buzzer.

ADC and DAC

ADC: Analog to Digital Converter.
Used when sensor signal is analog but microcontroller processes digital values.

DAC: Digital to Analog Converter.
Used when digital output must become analog voltage/current.

Interrupt

Interrupt is a signal that temporarily stops normal program execution and runs an Interrupt Service Routine.

Advantages:

  • fast response,
  • avoids constant checking.

ISR:

Interrupt Service Routine, the function executed when interrupt occurs.

Polling vs Interrupt

Polling Interrupt
CPU repeatedly checks status Device notifies CPU
Simple More efficient
Wastes CPU time Better for real-time events

Timer

Timer generates accurate delays or periodic events.

Uses:

  • delays,
  • PWM generation,
  • event counting,
  • scheduling.

Watchdog timer

Watchdog resets system if software hangs.

Method:

  • Program must periodically reset/kick watchdog.
  • If not, watchdog assumes failure and resets device.

RTOS

RTOS = Real-Time Operating System.

It gives deterministic response within deadlines.

Key terms:

  • task/thread,
  • priority,
  • scheduler,
  • latency,
  • deadline,
  • semaphore,
  • mutex.

Hard real-time:

  • Missing deadline is system failure.
  • Example: airbag.

Soft real-time:

  • Missing deadline degrades quality.
  • Example: video streaming.

Communication protocols

UART

  • asynchronous serial communication,
  • uses TX/RX lines,
  • no clock line,
  • common in debugging and modules.

SPI

  • synchronous,
  • fast,
  • master-slave,
  • uses MOSI, MISO, SCLK, SS.

I2C

  • synchronous,
  • two wires: SDA and SCL,
  • supports multiple devices using addresses.

Memory in embedded systems

  • ROM/Flash: stores program permanently.
  • RAM: temporary runtime data.
  • EEPROM: non-volatile small data storage.

Common MCQ traps

  • Microcontroller includes CPU, memory, and peripherals.
  • Interrupt is event-driven.
  • Polling wastes CPU cycles.
  • ADC converts analog to digital, not digital to analog.
  • Watchdog improves reliability by resetting stuck systems.