An embedded system is a specialized controller designed to perform a specific dedicated function within a larger mechanical or electrical system. Unlike a general-purpose computer, such as a laptop or a desktop, which is designed to handle a wide variety of tasks (word processing, gaming, web browsing), an embedded system is optimized for a single, well-defined purpose. These systems are ubiquitous in modern life, ranging from the simple controller in your microwave to the complex flight control systems in an aircraft.
Embedded systems are characterized by three main pillars: hardware, software, and real-time constraints. The hardware is often constrained by power consumption, physical size, and cost, while the software (often called firmware) must be highly efficient to run on limited resources.
To understand how these systems function, we must look at the fundamental building blocks that allow them to interact with the physical world:
In the design of embedded processors, two primary memory architectures are used. The distinction lies in how the system handles instructions (code) and data.
In a Von Neumann architecture, both instructions and data share the same memory space and the same bus. This is simpler to design but can lead to a "bottleneck" because the CPU cannot fetch an instruction and read/write data at the same time. In contrast, the Harvard architecture uses separate physical paths (buses) for instructions and data.
This separation allows for higher throughput. If we consider the time \( T \) required to complete a cycle, the Harvard architecture allows for parallel access, whereas Von Neumann might require a summation of time: $$ T_{total} = T_{instruction\_fetch} + T_{data\_access} $$ In a Harvard system, the overlap can significantly reduce the effective cycle time.
Many embedded systems are used to control physical processes. For instance, a thermostat must maintain a specific temperature by regulating a heater. This is achieved using a Proportional-Integral-Derivative (PID) controller. The goal is to minimize the error \( e(t) \), which is the difference between the desired setpoint and the measured process variable.
The mathematical representation of the PID control law in the time domain is given by the following equation:
$$u(t) = K_p e(t) + K_i \int_{0}^{t} e(\tau) \, d\tau + K_d \frac{de(t)}{dt}$$Where:
Since embedded systems interact with the analog world, they must utilize an Analog-to-Digital Converter (ADC). To accurately represent an analog signal in a digital format, the sampling rate must be sufficient. According to the Nyquist-Shannon sampling theorem, to avoid aliasing (the distortion of the signal), the sampling frequency \( f_s \) must be greater than twice the highest frequency component \( f_{max} \) present in the signal:
$$f_s > 2 \cdot f_{max}$$If this condition is not met, high-frequency components will "fold over" into the lower frequency spectrum, creating artifacts that the embedded system will incorrectly interpret as valid data.
A critical distinction in embedded systems is the concept of "Real-Time." A real-time system is not necessarily a "fast" system, but rather a "predictable" one. These systems are categorized into two types:
To manage these constraints, developers often use a Real-Time Operating System (RTOS). An RTOS provides determinism, ensuring that high-priority tasks are executed within a strictly defined time interval, a concept often measured by the system's latency.