Professional Documents
Culture Documents
CPS Unit2
CPS Unit2
CPS Unit2
A key concern for sensors and actuators is that the physical world
functions in a multidimensional continuum of time and space. It is an
analog world. The world of software, however, is digital, and strictly
quantized. Measurements of physical phenomena must be quantized in
both magnitude and time before software can operate on them. And
commands to the physical world that originate from software will also be
intrinsically quantized. Understanding the effects of this quantization is
essential.
Models of Sensors and Actuators
Interpreting the readings of such a sensor requires knowledge of the proportionality constant and
bias. The proportionality constant represents the sensitivity of the sensor, since it specifies the degree
to which the measurement changes when the physical quantity changes.
Actuators may also be modeled by affine functions. The affect that a command to the actuator has
on the physical environment may be reasonably approximated by a relation like (7.1).
Range
Dynamic Range
Quantization
Quantization: Problem
Sometimes, x and n often differ in frequency content, i.e., x may contain only low
frequencies, and n may contain only higher frequencies. Therefore, the best choice for S
will be a low-pass filter.
Common Sensors
• The movable mass has a neutral position, which is its position when the spring is
not deformed at all. It will occupy this neutral position if the entire assembly is in
free fall, or if the assembly is lying horizontally. If the assembly is instead aligned
vertically, then gravitational force will compress the spring and displace the
mass. To an observer in free fall, this looks exactly as if the assembly were
accelerating upwards at the acceleration of gravity, which is approximately g =
9.8 meters/second2.
• An accelerometer, therefore, can measure the tilt (relative to gravity) of the
fixed frame. Any acceleration experienced by the fixed frame will add or
subtract from this measurement. It can be challenging to separate these two
effects, gravity and acceleration. The combination of the two is what we call
proper acceleration.
Measuring Tilt and Acceleration
Very few actuators can be driven directly from the digital I/O pins
(GPIO* pins) of a microcontroller. These pins can source or sink a limited
amount of current, and any attempt to exceed this amount risks
damaging the circuits. One exception is light-emitting diodes (LEDs),
which when put in series with a resistor, can often be connected directly
to a GPIO pin. This provides a convenient way for an embedded system
to provide a visual indication of some activity.
Microcontrollers
DSP Processors
Microcontrollers
• A microcontroller (μC) is a small computer on a single integrated circuit
consisting of a relatively simple central processing unit (CPU) combined with
peripheral devices such as memories, I/O devices, and timers.
• By some accounts, more than half of all CPUs sold worldwide are
microcontrollers, although such a claim is hard to substantiate because the
difference between microcontrollers and general-purpose processors is
indistinct.
• The simplest microcontrollers operate on 8-bit words and are suitable for
applications that require small amounts of memory and simple logical functions
(vs. performance-intensive arithmetic functions).
• They may consume extremely small amounts of energy, and often include a
sleep mode that reduces the power consumption to nanowatts.
• Embedded components such as sensor network nodes and surveillance devices
have been demonstrated that can operate on a small battery for several years.
Microcontrollers
Most modern processors are pipelined. A simple five-stage pipeline for a 32-bit machine is shown
in Figure 8.2. Here, the shaded rectangles are latches, which are clocked at processor clock rate.
On each edge of the clock, the value at the input is stored in the latch register. The output is then
held constant until the next edge of the clock, allowing the circuits between the latches to settle.
This diagram can be viewed as a synchronous-reactive model of the behavior of the processor.
• In the fetch (leftmost) stage of the pipeline, a program counter (PC) provides an address to the
instruction memory. The instruction memory provides encoded instructions, which in the figure are
assumed to be 32 bits wide. The PC is incremented by 4 (bytes), to become the address of the next
instruction, unless a conditional branch instruction is providing an entirely new address for the PC.
• The decode pipeline stage extracts register addresses from the 32-bit instruction and fetches the data
in the specified registers from the register bank.
• The execute pipeline stage operates on the data fetched from the registers or on the PC (for a
computed branch) using an arithmetic logic unit (ALU), which performs arithmetic and logical
operations.
• The memory pipeline stage reads or writes to a memory location given by a register.
• The writeback pipeline stage stores results in the register file.
Memory Architectures
Memory Technologies
In embedded systems, memory issues loom large. The choices of memory
technologies have important consequences for the system designer. For
example, a programmer may need to worry about whether data will persist
when the power is turned off or a power-saving standby mode is entered. A
memory whose contents are lost when the power is cut off is called a
volatile memory.
RAM
• The most basic non-volatile memory today is ROM (read-only memory) or mask ROM, the
contents of which is fixed at the chip factory. This can be useful for mass produced
products that only need to have a program and constant data stored, and these data
never change. Such programs are known as firmware, suggesting that they are not as
“soft” as software.
• There are several variants of ROM that can be programmed in the field, and the
technology has gotten good enough that these are almost always used today over
mask ROM. EEPROM, electrically-erasable programmable ROM, comes in several forms,
but it is possible to write to all of these. The write time is typically much longer than the
read time, and the number of writes is limited during the lifetime of the device.
• A particularly useful form of EEPROM is flash memory. Flash is commonly used to store
firmware and user data that needs to persist when the power is turned off.
Memory Hierarchy