Eee Vi Embedded Systems (10ee665) Notes
Eee Vi Embedded Systems (10ee665) Notes
Eee Vi Embedded Systems (10ee665) Notes
10EE665
EMBEDDED SYSTEMS
:
10EE665
IA Marks
25
04
Exam
Hours
03
52
Exam
Marks
: 100
PART -A
UNIT - 1 & 2
TS
.IN
Subject Code
EN
Embedded
variants, RAM. Applications of embedded system: Examples of Embedded systems SOC for cell
UNIT - 3
10 Hours
TU
D
TS
& hold, multiplexer interface Internal ADC interfacing (excluding 6805 & 6812), Data
Acquisitio n System and Signal conditioning using DSP.
10 Hours
CI
UNIT - 4
DESIGN
TRADE OFFS
DUE TO
PROCESS
INCOMPATIBILITY, THERMAL
CITSTUDENTS.IN
6Hours
Page 1
EMBEDDED SYSTEMS
10EE665
PART -B
UNIT -5 & 6
Software aspects of Embedded Systems, real time programming Languages, operating systems.
Programming concepts and embedded programming in C.Round Robin, Round Robin with
function
queue-scheduling
architecture,
Real
time
OS
architecture,
selecting
TS
.IN
interrupts,
12 Hours
UNIT -7 & 8
Subsystem interfacing with external systems user interfacing, Serial I/O devices, Parallel port
EN
TEXT BOOKS:
1.
Embedded
TU
D
Case study: Embedded velocity PID controller, PI controller with a PWM actuator. 14Hours
Microcomputer
systems:
Real
time
interfacing-Valvano,
J.W,
Cengage
TS
CI
CITSTUDENTS.IN
Page 2
EMBEDDED SYSTEMS
10EE665
Table of contents
Unit
Title
UNIT - 1 & 2
Page no
TS
.IN
EN
UNIT - 3
22
TU
D
TS
UNIT - 4
CI
INCOMPATIBILITY, THERMAL
37
CONSIDERATIONS:
Issues in embedded system design.
Design challenge, design technology, trade
offs. Thermal considerations
UNIT -5 & 6
CITSTUDENTS.IN
51
Page 3
EMBEDDED SYSTEMS
10EE665
systems.
Programming concepts and embedded
programming in C.
Round Robin, Round Robin with interrupts,
function queue-scheduling architecture,
Real time OS architecture, selecting
TS
.IN
user interfacing,
70
EN
interfacing.
CI
TS
TU
D
CITSTUDENTS.IN
Page 4
EMBEDDED SYSTEMS
10EE665
UNIT - 1 & 2
CONCEPT OF EMBEDDED SYSTEM DESIGN: Components, classification, skills required.
Embedded Micro controller cores: Architecture of 6808 and 6811.Embedded Memories ROM
variants, RAM. Applications of embedded system: Examples of Embedded systems SOC for cell
less bar code scanner.
TU
D
EN
Processor
TS
.IN
Output/Output circuits
ii) Software: The application software is required to perform the series of tasks.
TS
CI
The need to limit power dissipation when running the system continuously in
cycles of wait for events, run , stop and wake up.
iii) Real Time Operating System: (RTOS) It supervises the application software
and provides a mechanism to let the processor run a process as per scheduling and
do the switching from one process (task) to another process.
CITSTUDENTS.IN
Page 5
EMBEDDED SYSTEMS
10EE665
Classification
We can classify embedded systems into three types as follows :
1. Small Scale Embedded Systems : These systems are designed with a single 8- or 16-bit
microcontroller; they have little hardware and software complexities and involve board -level
design. They may even be battery operated. When developing embedded software for these, an
editor, assembler and cross assembler, specific to the microcontroller or processor used, are the
TS
.IN
main programming tools. Usually, C is used for developing these systems. C program
compilation is done into the assembly, and executable codes are then appropriately located in the
system memory. The software has to fit within the memory available and keep in view the need
to limit power dissipation when system is running continuously.
2. Medium Scale Embedded Systems : These systems are usually designed with a single or few
EN
16- or 32-bit microcontrollers or DSPs or Reduced Instruction Set Computers (RISCs). These
have both hardware and software complexities. For complex software design, there are the
following programming tools: RTOS, Source code engineering tool, Simulator, Debugger and
TU
D
Integrated Development Environment (IDE). Software tools also provide the solutions to the
hardware complexities. An assembler is of little use as a programming tool. These systems may
also employ the readily available ASSPs and IPs (explained later) for the various functionsfor
example, for the bus interfacing, encrypting, deciphering, discrete cosine transformation and
TS
inverse transformation, TCP/IP protocol stacking and network connecting functions. [ASSPs and
IPs may also have to be appropriately configured by the system software before being integrated
into the system-bus.
CI
processors and programmable logic arrays. They are used for cutting edge applications that need
hardware and software co-design and integration in the final system; however, they are
constrained by the processing speeds available in their hardware units. Certain software
functions such as encryption and deciphering algorithms, discrete cosine transformation and
inverse transformation algorithms, TCP/IP protocol stacking and network driver functions are
implemented in the hardware to obtain additional speeds by saving time. Some of the functions
CITSTUDENTS.IN
Page 6
EMBEDDED SYSTEMS
10EE665
of the hardware resources in the system are also implemented by the software. Development
tools for these systems may not be readily available at a reasonable cost or may not be available
at all. In some cases, a compiler or retargetable compiler might have to be developed for these.
Skills Required
An embedded system designer has to develop a product using the available tools within the given
TS
.IN
1. Skills for Small Scale Embedded System Designer: Author Tim Wilmshurst in the book
referred above (see page 4), has said that the following skills are needed in the individual or team
Full understanding of microcontrollers with a basic
of computer
architecture,
software engineering,
data
EN
communication, control engineering, motors and actuators, sensors and measurements, analog
electronic design and IC design and manufacture. Specific skills will be needed in specific
situations. For example, control engineering knowledge will be needed for design of control
TU
D
systems and analog electronic design knowledge will be needed when designing the system
interfaces. Basic aspects of the following topics will be described in this book to prepare the
designer who already has a good knowledge of the microprocessor or microcontroller to be used.
Computer architecture and organization.
TS
Memories.
Memory allocation.
CI
Burning (a term used for porting) the executable machine codes in PROM or ROM.
Use of decoders and demultiplexers.
Page 7
EMBEDDED SYSTEMS
10EE665
C programming elements.
Memory optimization.
Selection of hardware and microcontroller.
Use of ICE (In-Circuit Emulators), cross-assemblers and testing equipment.
Debugging the software and hardware bugs by using test vectors.
TS
.IN
A designer interested in small-scale embedded systems may not need at all concepts of interrupt
latencies and deadlines and their handling, the RTOS programming tools.
2. Skills for Me dium Scale Embe dde d Sys te m De s igne r: C programming and RTOS programming
and program modeling skills are a must to design a medium-scale embedded system. Knowledge of the
EN
TU
D
Use of shared data, and programming the critical sections and re -entrant functions.
Use of semaphores, mailboxes, queues, sockets and pipes.
Handling of interrupt-latencies and meeting task deadlines.
TS
A designer must have access to an RTOS programming tool with Application Programming Interfaces
CI
(APIs) for the specific microcontroller to be used. Solutions to various functions like memory allocation,
timers, device drivers and interrupt handing mechanism are readily available as the APIs of the RTOS.
The designer needs to know only the hardware organization and use of these APIs. The microcontroller
or processor then represents a small system element for the designer and a little knowledge may suffice.
3. Skills for Sophis ticate d Embe dde d Sys te m De s igne r: A team is needed to co-design and solve the
high level complexities of the hardware and software design. An embedded system hardware engineer
should have full skills in hardware units and basic knowledge of C, RTOS and other programming tools.
CITSTUDENTS.IN
Page 8
EMBEDDED SYSTEMS
10EE665
Software engineer should have basic knowledge in hardware and a thorough knowledge of C, RTOS
and other programming tools. A final optimum design solution is then obtained by system integration.
TS
.IN
The 6808 is an advanced 8-bit MCU IP Core with highly sophisticated, on chip peripheral capabilities.
6808 soft core is binary-compatible with the industry standard 68HC08 8-bit microcontroller and can
achieve a performance 45-100 million instructions per second. There are two configurations of DF6808:
Harvard where data and program buses are separated and von Neumann with common program and data
bus DF6808 has FAST architecture that is 3.2 times faster compared to original implementation. Core in
standard configuration has integrated on chip major peripheral function. The 6808 Microcontroller Core
CI
TS
TU
D
EN
contains full-duplex UART (Asynchronous serial communications interface (SCI), and Synchronous
CITSTUDENTS.IN
Page 9
EMBEDDED SYSTEMS
10EE665
The main 16-bit, free-running timer system has implemented two input capture lines and two output-
compare lines.
computer operating properly (COP) watchdog system protects against software failures. An
illegal opcode detection circuit provides a nonmaskable interrupt if illegal opcode is detected.
Two software-controlled power-saving modes, WAIT and STOP, are available to conserve
additional power. These modes make the DF6808 IP Core especially attractive for automotive
and battery-driven applications.
TS
.IN
DF6808 is fully customizable, which means it is delivered in the exact configuration to meet
users requirements. There is no need to pay extra for not used features and wasted silicon. It
includes fully automated test bench with complete set of tests allowing easy package validation
at each stage of SoC design flow.
Features
EN
TU
D
TS
Ready pin allows Core to operate with slow program and data memories
Fully synthesizable, static synchronous design with no internal tri-states
CI
CITSTUDENTS.IN
Page 10
EMBEDDED SYSTEMS
10EE665
CI
TS
TU
D
EN
TS
.IN
There are two serial interfaces: an asynchronous serial communications interface (SCI) and a
The main 16-bit, free-running timer system has implemented three input capture lines, five
output-compare lines, and a real-time interrupt function.
chip to protect against system errors. A computer operating properly (COP) watchdog system
protects against software failures. An illegal opcode detection circuit provides a non-maskable
CITSTUDENTS.IN
Page 11
EMBEDDED SYSTEMS
10EE665
STOP, are available to conserve additional power. These modes make the DF6811 IP Core
especially attractive for automotive and battery-driven applications.
the development support features designed into DF6811. The LIR signal is intended as a
debugging aid. This signal is driven to active low for the first bus cycle of each new instruction,
making it easy to reverse assemble (disassemble) instructions from the display of a logic
analyzer.
TS
.IN
meet users requirements. There is no need to pay extra for not used features and wasted silicon.
It includes fully automated testbench with complete set of tests allowing easy package validation
at each stage of SoC design flow.
EN
Features
TU
D
TS
CI
Embedded Memories
In a system, there are various types of memories. Figure below shows a chart for the various
CITSTUDENTS.IN
Page 12
EMBEDDED SYSTEMS
10EE665
TS
.IN
TU
D
EN
Table gives the functions assigned in the embedded systems to the memories. ROM or PROM or
CI
TS
Page 13
EMBEDDED SYSTEMS
10EE665
location, so data can be accessed quickly in any random order. In contrast, other data storage
media such as hard disks, CDs, DVDs and magnetic tape, as well as early primary memory types
such as drum memory, read and write data only in a predetermined order, consecutively, because
of mechanical design limitations. Therefore the time to access a given data location varies
significantly depending on its physical location
TS
.IN
Embedded Systems has witnessed tremendous growth in the last one decade. Almost all the fast
developing sectors like automobile, aeronautics, space, rail, mobile communications, and
electronic payment solutions have witnessed increased use of Embedded technologies. Greater
value to mobility is one of the prominent reasons for the rise and development of Embedded
technologies.
that included
TU
D
EN
Initially, Embedded Systems were used for large, safety-critical and business-critical applications
TS
Embedded Systems research and development is now concerned with a very large proportion of
the advanced products designed in the world. In one way, embedded technologies run global
CI
transport industry that includes avionics, space, automotive, and trains. But, it is the electrical
and electronic appliances like cameras, toys, televisions, home appliances, audio systems, and
cellular phones that really are the visual interface of Embedded Systems for the common
consumer.
(energy
production
and
distribution,
factory
automation
and
Page 14
EMBEDDED SYSTEMS
10EE665
TS
.IN
Targeting a given market segment at the lowest cost and delivery time possible
Seamless integration with the physical and electronic environment
EN
Automobile sector
Automobile sector has been in the forefront of acquiring and utilizing Embedded technology to
produce highly efficient electric motors. These electric motors include brushless DC motors,
TU
D
Embedded technology finds immediate importance in electric vehicles, and hybrid vehicles. Here
TS
Embedded applications bring about greater efficiency and ensure reduced pollution. Embedded
technology has also helped in developing automotive safety systems such as the
Anti-lock braking system (ABS)
CI
Page 15
EMBEDDED SYSTEMS
10EE665
TS
.IN
Telecommunications
If ever there is an industry that has reaped the benefits to Embedded Technology, for sure, it is
only Telecommunications.
telephone switches for the network to mobile phones at the end-user. The Telecom computer
EN
network also uses dedicated routers and network bridges to route data. Embedded engineers help
in ensuring high-speed networking. This is the most critical part of embedded applications. The
Ethernet switches and network interfaces are designed to provide the necessary bandwidth.
applications.
TU
D
These will allow in rapidly incorporating Ethernet connections into advanced embedded
Consumer Electronics
TS
CI
MP3 players
Mobile phones
Videogame consoles
Digital cameras
DVD players
GPS receivers
Printers
CITSTUDENTS.IN
Page 16
EMBEDDED SYSTEMS
Even the
household
10EE665
appliances,
that include
dishwashers, are including embedded systems to provide flexibility, efficiency and features. The
latest in embedded applications are seen as advanced HVAC systems that uses networked
thermostats to more accurately and efficiently control temperature.
In the present times, home automation solutions are being increasingly built on embedded
technologies. Home automation includes wired and wireless-networking to control lights,
climate, security, audio/visual, surveillance, etc., all of which use embedded devices for sensing
TS
.IN
and controlling.
Railroad
Railroad signaling in Europe relies heavily on embedded systems that allows for faster, safer and
heavier traffic. Embedded technology has brought a sea of change in the way Railroad Signals
EN
The Embedded technology enabled Railroad Safety Equipment is increasingly being adopted by
Railway networks across the globe, with an assurance of far lesser Rail disasters to report.
industry.
TU
D
VECTOR Institute prepares embedded students for the challenges associated with Railroad
TS
In the present times there is stiff competition amongst embedded solutions providers to deliver
innovative, and high-performance electronic payment solutions that are easy to use and highly
CI
CITSTUDENTS.IN
Page 17
EMBEDDED SYSTEMS
10EE665
Smart cards, though began prominently as either a debit or a credit card, are now being
introduced
national, and
international levels. Smart cards are appearing now as Citizen Cards, drivers licenses, and
patient cards.
We also come across contactless smart cards that are part of ICAO biometric passports aim to
TS
.IN
enhance security for international travel. Europe enjoys precedence in the use of Smart cards. All
the E-services (e-banking, e-health, e-training) are based on the leading edge in smart-card
related technologies.
EN
Example of Embedded systems SOC for cell less bar code scanner.
Lately, embedded systems are being designed on a single silicon chip, called System on chip
(SoC). SoC is a new design innovation for embedded systems. An embedded processor is a part
TU
D
of the SoC VLSI circuit. A SoC may be embedded with the following components: multiple
processors, memories, multiple standard source solutions, called IP (Intellectual Property) cores
and other logic and analog units. A SoC may also have a network protocol embedded into it. It
may also embed an encryption function unit. It can embed discrete cosine transforms for signal
For a
TS
processing applications. It may embed FPGA (Field Programmable Gate Array) cores.
number of applications, the GPP (microcontrollers, microprocessors or DSPs) cores may not
suffice. For security applications, killer applications, smart card, video game, palm top computer,
CI
cell phone, mobile-Internet, hand-held embedded systems, Gbps transceivers, Gigabits per
second LAN systems and satellite or missile systems, we need special processing units in a VLSI
designed circuit to function as a processor. These special units are called Application Specific
Instruction Processors (ASIP). For an application, both the configurable processors (called
FPGA cum ASIP processors) and non-configurable processors (DSP or Microprocessor or
Microcontrollers) might be needed on a chip.
CITSTUDENTS.IN
Page 18
EMBEDDED SYSTEMS
10EE665
Block Diagram
A barcode reader (or barcode scanner) is an electronic device for reading printed barcodes. Like
a flatbed scanner, it consists of a light source, a lens and a light sensor translating optical
impulses into electrical ones. Additionally, nearly all barcode readers contain decoder circuitry
analyzing the barcode's image data provided by the sensor and sending the barcode's content to
CI
TS
TU
D
EN
TS
.IN
Design Considerations
Features
TMS320C54x DSPs
CITSTUDENTS.IN
Page 19
EMBEDDED SYSTEMS
10EE665
TS
.IN
Internal gain (TPA3007D1: 12, 18, 23.6, 36dB) Independent gain control ('2005D1)
THD+N = 0.2% at 1kHz; PSRR = -73 dB ('3007D1) & -75dB ('2005D1) Touch Screen
Controller
Integrated 4-wire touch screen controller
EN
Highly programmable
TU
D
Accepts 16- to 24-bit data; Left, Right I2S Format; wide sampling frequency - 5kHz to
200kHz
Hardware controlled
TS
Benefits
CI
Page 20
EMBEDDED SYSTEMS
10EE665
Audio DAC
Flexible interface to processor
Simplifies system design
CI
TS
TU
D
EN
TS
.IN
Minimizes noise
CITSTUDENTS.IN
Page 21
EMBEDDED SYSTEMS
10EE665
UNIT - 3
TECHNOLOGICAL ASPECTS OF EMBEDDED SYSTEM : Interfacing between analog and
digital blocks, Signal conditioning, digital signal processing, DAC & ADC interfacing, Sample
& hold, multiplexer interface Internal ADC interfacing (excluding 6805 & 6812), Data
Acquisitio n System and Signal conditioning using DSP.
TS
.IN
Analog refers to physical quantities that vary continuously instead of discretely. Physical
phenomena typically involve analog signals. Examples include temperature, speed, position,
pressure, voltage, altitude, etc. Microprocessors work with digital quantities (values taken from
the discrete domain). For a digital system to interact with analog systems, conversion between
EN
analog and digital values is needed. Building blocks to perform the conversions are: (1) Digital
to analog converters (DACs), (2) Analog to digital converters (ADCs). A digital to analog
converter has a digital input that specifies an output whose value changes in steps. These step
changes are in volts or amperes. The analog to digital converter has an input that can vary from a
CI
TS
TU
D
minimum to a maximum value of volts or amperes. The output is a digital number that represents
Transducers
A device that converts a process variable (ex. Car speed) into an electrical signal or vice versa.
Sensors (Input transducers): Potentiometer (position); strain gauge, piezoelectric device
(force); thermistor, thermocouple (temperature); photoconductive cell, phototransistor (light);
current transformer, SENSEFET (current); microphone (sound), etc.
CITSTUDENTS.IN
Page 22
EMBEDDED SYSTEMS
10EE665
Actuators (Output transducers): solenoids, relays, speakers; darlington transistors, triacs, etc.
TS
TU
D
EN
TS
.IN
Signal Conditioning
CI
Signal conditioning is sometimes necessary because raw sensor outputs are not always suitable
for analog-to-digital conversion.
Amplification: Op amps are preferred because of their performance characteristics
Open Loop gain: several hundred thousand, input current ~0, output
impedance ~0.
Filtering: LPF
CITSTUDENTS.IN
Page 23
EMBEDDED SYSTEMS
10EE665
De finitions
Offset: minimum value
Span: maximum value minimum value of Some common spans:
range of 0 V to 5 V: span = 5 V
range of 12 V to 12 V: span = 24 V
TS
.IN
Weight: The analog change corresponding to a change in a bit in the digital number.
Step size: span / 2n (Typically, the digital representation is an unsigned n- bit integer) (n is
the number of bits in the corresponding digital code. e.g. n=0 for a 1-bit number)
Resolution: Same as step size. Weight of the LSB.
EN
TU
D
Span = 10 V
Step size = 10 / 256 = 39.1 mV
Notice that the MSB has a weight of 5 V (= span/ 2), and the LSB has a weight of .0391 V
Equations
TS
CI
These equations hold true as long as the numbers are within the range. If the input of an A/D is
below the minimum or above the maximum of the range, the corresponding digital value will be
minimum or maximum, respectively. In practice, extreme input swing beyond the specified
range may damage the device.
Example:
CITSTUDENTS.IN
Page 24
EMBEDDED SYSTEMS
10EE665
6-bit D/A converter, analog output range:-2.5 to 5 volts. Calculate the analog output when the
input is %010101 (decimal 21)
Offset: -2.5 V
Span: 7.5 V
TS
.IN
Example: As an example the following table lists some values for -5 V to +5 V analog ranges to
8-bit digital conversion:
-5
-3.75
-2.5
TU
D
-1.25
Digital (hex)
EN
Analog (V)
00
20
40
60
80
1.25
A0
2.5
C0
3.75
E0
TS
5-0.0391=4.961
FF
CI
Digital-to-Analog Converters
A DAC takes an n- bit digital input and output a corresponding analog voltage. DAC systems
normally consist of three components: (a) A reference voltage, (b) The DAC itself, (c) An op
amp for output buffering.
CITSTUDENTS.IN
Page 25
10EE665
TS
TU
D
EN
TS
.IN
EMBEDDED SYSTEMS
Many digital-to-analog converters use R-2R ladder network. Inverted ladder type of network is
CI
shown in the figure below. The switches are analog switches controlled by digital signals. The
output voltage (V) is proportional to the binary input. Each branch of the ladder network
contributes current whose value is proportional to the bit weight of that branch. The amplifier
circuit sums the current components to produce a voltage proportional to the binary input.
CITSTUDENTS.IN
Page 26
10EE665
TS
.IN
EMBEDDED SYSTEMS
EN
DAC integrated circuits are available with different bit resolutions. In principle, any DAC can be
interfaced to any microprocessor system. In practice, some combinations of DACs and
microprocessors are easier than others and require much simpler hardware and software in the
TU
D
interface. Here, interfacing a 12-bit DAC to an 8-bit microprocessor will be considered. This will
serve to show how to mate different bit resolutions with different size data buses. Also, the
CI
TS
CITSTUDENTS.IN
Page 27
EMBEDDED SYSTEMS
10EE665
The figure given above shows an interface for a microprocessor operating in expanded
multiplexed mode. The latches are used to convert a sequence of 2 bytes into one 12 -bit word.
To output a 12-bit word, the microprocessor writes the data in two steps. First, it puts the upper 4
bits on the lower nibble of the data bus. Then it selects the latch address. The address decoder
decodes the address and drives the latch chip select input low. Also, the microprocessor d rives
the address line A0 low so that only the 4-bit latch accepts data from the data bus. Then the
microprocessor repeats the sequence for the lower 8 bits except that it drives A0 high. The other
TS
.IN
purpose of the latches is to provide the double buffering. The updated latch data is not
transferred to the DAC until the microprocessor drives the control line to latch in data to the
buffer in the DAC. DAC does not change its output until is driven low. Note that this is
important when there is a change in the upper nibble.
EN
Analog-to-Digital Converters
The function of ADCs is to quantize the analog voltage and then output the corresponding digital
code value. As with the DAC conversion, a full- scale analog voltage will be divided into 2
the conversion.
TU
D
quantization levels or steps for an n- bit digital coding scheme. Several techniques are used to do
Among them successive approximation which has a medium conversion speed
TS
The ADC has a built in DAC. A sample and hold circuit stores an analog input. The ADC logic
steps through a sequence of trial-and-error guessing to find the digital equivalent of the input. It
begins the sequence by sending a digital signal that is at midrange to the DAC. The analog
CI
output Vout from the DAC is compared to the analog input Vin from the sample-and-hold circuit.
Thus, the ADC determines whether the analog input is above, at or below half scale. It continues
determining to which half of the next range selection the analog input belongs.
CITSTUDENTS.IN
Page 28
EMBEDDED SYSTEMS
10"EE665
DIGITAL
OUTPUT
+- ---,
VIN from on onolog sample end hold circuit
DONE
CONVfRSION _
COt.lP.ARATOR
DAC
LOGIC
1----'-- o
TS
TU
D
(a)
EN
TS
.IN
OUT analog
CI
CITSTUDENTS.IN
Page 29
EMBEDDED SYSTEMS
10"EE665
STEP 1
Start with
05 = 1
Keep 05 = 1
STEP 2
Start with
04 = 1
TS
.IN
Guess
Low
EN
Guess
Low
Keep 04
Start with
03 = 1
TU
D
STEP 3
Guess
High
CI
TS
Reset 03 = 0
CITSTUDENTS.IN
Page 30
10EE665
TU
D
EN
TS
.IN
EMBEDDED SYSTEMS
The 68HC11 has a built-in A/D subsystem, but it does not have a D/A, although it can easily be
interfaced to one. External D/A converter such as DAC0808 ( 8-bit D/A) can be used. 68HC11
uses an A/D which in turn uses a D/A to generate internal signals as part of the process to
TS
CI
Control registers:
o
CITSTUDENTS.IN
Page 31
EMBEDDED SYSTEMS
TU
D
EN
TS
.IN
10EE665
CI
TS
CITSTUDENTS.IN
Page 32
EMBEDDED SYSTEMS
10EE665
DAC is replaced by a series of capacitors that are charged to the voltages that correspond
to the weights of each bit
During the sample mode, the capacitors are charged. This total charge is proportional to
the input analog signal. For the duration of the conversion process, this total charge
remains conserved. The A/D switches to the hold mode and then to the approximation
mode. The approximation mode is a sequence of successive approximation steps that
TS
.IN
switches different capacitors to modify the input voltage to the comparator. The result of
each step sets or resets a corresponding bit in a successive approximation register (SAR).
VRH is normally set to the signal maximum (analog value for digital data $FF) and VRL is
set to minimum (analog value of $00). However, VRH should not be higher than 6 V and
VRL should not be lower than ground, and VRH - VRL should be greater than 2.5 V.
8-bit outputs from four successive conversions are placed into analog data registers
EN
ADR1-ADR4.
TU
D
The MCU on the EVB has an 8-bit register at location $1030 that is the A/Ds control and status
register (ADCTL). Bits 0-5 are the control bits and may be read from or written to. Bit 6 is not
used and is always read as logic 0. Bit 7 is a status bit and can only be read. Data written to this
TS
bit is ignored.
CI
Data acquisition systems (DAS) interface between the real world of physical parameters, which
are analog, and the articial world of digital computation and control. With current emphasis on
digital systems, the interfacing function has become an important one; digital systems are used
widely because complex circuits are low cost, accurate, and relatively simple to implement. In
addition, there is rapid growth in the use of microcomputers to perform difficult digital control
and measurement functions. Computerized feedback control systems are used in many different
industries today in order to achieve greater productivity in our modern industrial societies.
Industries that presently employ such automatic systems include steel making, food processing,
CITSTUDENTS.IN
Page 33
EMBEDDED SYSTEMS
paper
production,
10EE665
oil
rening,
chemical
manufacturing,
textile
production,
cement
and digital worlds are analog-to-digital (A/D) and digital-to-analog (D/A) converters, which
together are known as data converters. Some of the specic applications in which data converters
are used include data telemetry systems, pulse code modulated communications, automatic test
systems, computer display systems, video signal processing systems, data logging systems, and
TS
.IN
sampled data control systems. In addition, every laboratory digital multimeter or digital panel
Besides A/D and D/A converters, data acquisition and distribution systems may employ one or
more of the following circuit functions:
transducers,
ampliers,
lters,
analog multiplexers,
sample-holds.
TU
D
EN
The interconnection of these components is shown in the diagram of the data acquisition portion
The input to the system is a physical
TS
parameter such as temperature, pressure, ow, acceleration, and position, which are analog
quantities. The parameter is rst converted into an electrical signal by means of a transducer;
CI
Next, an amplier boosts the amplitude of the transducer output signal to a useful level for
further processing .
Transducer outputs may be microvolt or millivolt level signals, which are then amplied to 1 to
10 V levels. Furthermore, the transducer output may be a highimpedance signal, a differential
CITSTUDENTS.IN
Page 34
EMBEDDED SYSTEMS
10EE665
signal with common-mode noise, a current output, a signal superimposed on a high voltage, or a
TS
.IN
combination
specialized types.
EN
The amplier, in order to convert such signals into a high-level voltage, may be one of several
The amplier is frequently followed by a low-pass active lter that reduces
TU
D
from the signal. The amplier is sometimes also followed by a special nonlinear analog function
circuit that performs a nonlinear operation on the high-level signal. Such operations include
squaring,
multiplication,
division,
rms
conversion,
log
conversion,
or
linearization.
The
processed analog signal next goes to an analog multiplexer, which switches sequentially between
a number of different analog input channels each input is in turn connected to the output of the
TS
multiplexer for a specied period of time by the multiplexer switch. During this connection time,
a sample-hold circuit acquires the signal voltage and then holds its value while an A/D converter
converts the value into digital form. The resultant digital word goes to a computer data bus or to
CI
Thus the analog multiplexer, together with the sample hold, time shares the A/D converter with a
number of analog input channels.
digital circuit called a programmer sequencer, which in turn is under the control of the computer.
In some cases, the computer itself may control the entire DAS. While this is perhaps the most
commonly used DAS conguration, there are alternative ones. Instead of multiplexing high-level
CITSTUDENTS.IN
Page 35
EMBEDDED SYSTEMS
10EE665
signals, low-level multiplexing is sometimes used with the amplier following the multiplexer.
In such cases, just one amplier is required, but its gain may have to be changed from one
channel to the next during multiplexing. Another method is to amplify and convert the signal into
digital form at the transducer location and send the digital information in serial form to the
computer. Here, the digital data must be converted to parallel form and then multiplexed onto the
TS
.IN
The use of a digital signal processor offers the designer the ability to compensate for, or to
completely avoid, the limitations outlined in the last section. The effects of residual null signal
and transducer non-linearity can be compensated by digital error correction, while the use of
EN
digital demodulation techniques make the system insensitive to spurious phase shifts up to 90
degrees. A software correction algorithm is easily able to compensate for static errors in the
output measurement by means of a software correction map. The software determines a
TU
D
correction offset y interpolation between the nearest points in the map and applies it to the
measurement a simple process taking only a few CPU cycles. The correction map is stored in
internal non-volatile memory, and can be programmed during routine calibration of the
CI
TS
transducer.
CITSTUDENTS.IN
Page 36
EMBEDDED SYSTEMS
10EE665
UNIT 4
DESIGN TRADE OFFS
CONSIDERATIONS:
Issues in embedded
considerations.
DUE
system design.
TO
PROCESS
Design
challenge,
INCOMPATIB ILITY,
THERMAL
Thermal
TS
.IN
Embedded computers typically have tight constraints on both functionality and implementation.
In particular, they must guarantee real time operation reactive to external events, conform to size
and weight limits, budget power and cooling consumption, satisfy safety and reliability
requirements, and meet tight cost targets.
EN
Real time system operation means that the correctness of a computation depends, in part, on the
time at which it is delivered. In many cases the system design must take into account worst case
TU
D
performance. Predicting the worst case may be difficult on complicated architectures, leading to
overly pessimistic estimates erring on the side of caution. The Signal Processing and Mission
Critical example systems have a significant requirement for real time operation in order to meet
TS
Reactive computation means that the software executes in response to external events. These
events may be periodic, in which case scheduling of events to guarantee performance may be
CI
possible. On the other hand, many events may be aperiodic, in which case the maximum event
arrival rate must be estimated in order to accommodate worst case situations. Most embedded
systems have a significant reactive component.
Design challenge:
Worst case design analyses without undue pessimism in the face of hardware with
statistical performance characteristics e.g., cache memory.
CITSTUDENTS.IN
Page 37
EMBEDDED SYSTEMS
10EE665
Many embedded computers are physically located within some larger artifact. Therefore, their
form factor may be dictated by aesthetics, form factors existing in pre-electronic versions, or
having to fit into interstices among mechanical components. In transportation and portable
systems, weight may be critical for fuel economy or human endurance. Among the examples, the
TS
.IN
Mission Critical system has much more stringent size and weight requirements than the others
because of its use in a flight vehicle, although all examples have restrictions of this type.
Design challenges:
EN
Packaging and integration of digital, analog, and power circuits to reduce size.
TU
D
Some systems have obvious risks associated with failure. In mission-critical applications such as
aircraft flight control, severe personal injury or equipment damage could result from a failure of
the
embedded
computer.
Traditionally,
such systems
have
employed
multiply-redundant
TS
CI
However, many embedded systems that could cause personal or property damage cannot tolerate
the added cost of redundancy in hardware or processing capacity needed for traditional fault
tolerance techniques. This vulnerability is often resolved at the system level as discussed later.
Design challenge:
CITSTUDENTS.IN
Page 38
EMBEDDED SYSTEMS
10EE665
Harsh environment
Many embedded systems do not operate in a controlled environment. Excessive heat is often a
problem,
especially
in
applications
involving
combustion
(e.g., many
transportation
applications). Additional problems can be caused for embedded computing by a need for
protection from vibration, shock, lightning, power supply fluctuations, water, corrosion, fire, and
general physical abuse. For example, in the Mission Critical example application the computer
must function for a guaranteed, but brief, period of time even under non-survivable fire
TS
.IN
conditions.
Design challenges:
EN
Cost sensitivity
TU
D
Even though embedded computers have stringent requirements, cost is almost always an issue
(even increasingly for military systems). Although designers of systems large and small may talk
about the importance of cost with equal urgency, their sensitivity to cost changes can vary
dramatically. A reason for this may be that the effect of computer costs on profitability is more a
TS
function of the proportion of cost changes compared to the total system cost, rather than
compared to the digital electronics cost alone. For example, in the Signal Processing system cost
sensitivity can be estimated at approximately $1000 (i.e., a designer can make decisions at the
CI
$1000 level without undue management scrutiny). However, with in the Small system decisions
increasing costs by even a few cents attract management attention due to the huge multiplier of
production quantity combined with the higher percentage of total system cost it represents.
Design challenge:
Variable "design margin" to permit tradeoff between product robustness and aggressive
cost optimization.
CITSTUDENTS.IN
Page 39
EMBEDDED SYSTEMS
10EE665
Design challenge
Design matrics:
A Design metric is a measure of implementations features such as cost, size, performance and
power. Embedded system
TS
.IN
The embedded system designer must be designed to meet the desired functionality. Apart
meeting the functionality, should also consider optimizing numerous design metrics.
EN
NRE( non recurring engineering Cost) : The one time monetary cost of designing the
TU
D
system.
Unit cost: Monetary cost of manufacturing each copy of the system, excluding NRE cost.
Size: physical space required by the system. Often measured in terms of bytes in case of
software, and no. of gates in terms of hardware.
TS
CI
Maintainability: ability to modify the system after its release to the market.
Correctness: our confidence that we have implemented systems functionality correctly.
Safety: probability that the system does not cause any harm.
Metrics typically compete with one another: improving one often leads to worsening of
CITSTUDENTS.IN
Page 40
EMBEDDED SYSTEMS
10EE665
CI
TS
TU
D
EN
TS
.IN
another
CITSTUDENTS.IN
Page 41
EMBEDDED SYSTEMS
10EE665
TS
.IN
EN
Market windows generally will be very narrow, often in the order of few months.
CI
TS
TU
D
Time to Market
(A) Market window and simplified revenue model for computing revenue loss
CITSTUDENTS.IN
Page 42
EMBEDDED SYSTEMS
10EE665
Lets investigate the loss of revenue that can occur due to delayed entry of a product in the
market. We can use a simple triangle model y axis is the market rise, x axis to represent the point
of entry to the market. The revenue for an on time market entry is the area of the triangle labeled
on time and the revenue for a delayed entry product is the area of the triangle labeled
Delayed. The revenue loss for a delayed entry is the difference of these triangles areas.
TS
.IN
EN
TU
D
TS
By
CI
Unlike other design metric the best technology choice will depend on the no of units.
Tech: A
would result in
$30000
$30
100000
$2
CITSTUDENTS.IN
Page 43
EMBEDDED SYSTEMS
10EE665
Performance of a system is a measure of how long the system takes to execute our desired tasks.
TS
.IN
There are several measures of performance. The two main measures are:
EN
TU
D
DESIGN TECHNOLOGY:
Design technology involves the manner in which we convert our concept of desired system
functionality into an implementation. We must not only design the implementation to optimise
TS
Variations of a top-down design process have become popular in the past decade, an ideal form
CI
of which is illustrated in the figure. The designer refines the system through several abstraction
levels. At the system level the designer describes the desired functionality in an executable
The designer refines this specification by distributing portions of it among several general and/or
single purpose processors, yielding behavioural specifications for each processor.
Page 44
EMBEDDED SYSTEMS
10EE665
Finally, the designer refines the remaining specifications into an implementation consisting of
machine code for general purpose processors and a design gate level net list for single purpose
processors.
TU
D
EN
TS
.IN
There are three main approaches to improving the design process for increased productivity,
label as
compilation/synthesis,
TS
which we
CI
Compilation/Synthesis
Describing a
system at high
abstraction levels can improve productivity by reducing the amount of details, often by an order
of magnitude, that a design must specify.
CITSTUDENTS.IN
Page 45
EMBEDDED SYSTEMS
10EE665
A logic synthesis tool converts Boolean expressions into a connection of logic gates (called a net
list). A register-transfer (RT) synthesis tool converts finite-state machines and register-transfers
into a data path of RT components and a controller of Boolean equations. A behavioral synthesis
tool converts a sequential program into finite-state machines and register transfers. Likewise, a
software compiler converts a sequential program to assembly code, which is essentially registertransfer code. Finally, a system synthesis tool converts an abstract system specification into a set
of sequential programs
TS
.IN
The relatively recent maturation of RT and behavioral synthesis tools has enabled a unified view
of the design process for single-purpose and general-purpose processors. Design for the former is
commonly known as hardware design, and design for the latter as software design. In the
past, the design processes were radically different software designers wrote sequential
EN
The co-design ladder: Recent maturation of synthesis enables a unified view of hardware
CI
TS
TU
D
and software.
CITSTUDENTS.IN
Page 46
EMBEDDED SYSTEMS
10EE665
Libraries/IP
Libraries
involve
re-use
of
pre-existing
implementations.
Using
libraries
of
existing
implementations can improve productivity if the time it takes to find, acquire, integrate and test a
library item is less than that of designing the item oneself. A logic-level library may consist of
layouts for gates and cells. An RT-level library may consist of layouts for RT components, like
commonly used
components,
such as
TS
.IN
registers, multiplexors, decoders, and functional units. A behavioral-level library may consist of
compression components, bus interfaces, display
controllers, and even general purpose processors. The advent of system-level integration has
caused a great change in this level of library.
EN
Test/Verification
Test/Verification involves ensuring that functionality is correct. Such assurance can prevent
time-consuming debugging at low abstraction levels and iterating back to high abstraction levels.
TU
D
Simulation is the most common method of testing for correct functionality, although more formal
verification techniques are growing in popularity. At the logic level, gate level simulators
CI
TS
CITSTUDENTS.IN
Page 47
EMBEDDED SYSTEMS
10EE665
Likewise, general-purpose processor simulators execute machine code. At the RT-level, hardware
description language (HDL) simulators execute RT-level descriptions and provide output waveforms
given input waveforms. At the behavioral level, HDL simulators simulate sequential programs, and cosimulators connect HDL and general purpose processor simulators to enable hardware/software coverification. At the system level, a model simulator simulates the initial system specification using an
abstract computation model, independent of any processor technology, to verify correctness and
TS
.IN
There are numerous additional approaches to improving designer productivity. Standards focus on
developing well-defined methods for specification, synthesis and libraries. Such standards can reduce the
problems that arise when a designer uses multiple tools, or retrieves or provides design information from
or to other designers. Common standards include language standards, synthesis standards and library
EN
standards.
Languages focus on capturing desired functionality with minimum designer effort. For example, the
TU
D
sequential programming language of C is giving way to the object oriented language of C++, which in
turn has given some ground to Java. As another example, state -machine languages permit direct capture
of functionality as a set of states and transitions, which can then be translated to other languages like C.
Frameworks provide a software environment for the application of numerous tools throughout the design
TS
process and management of versions of implementations. For example, a framework might generate the
UNIX directories needed for various simulators and synthesis tools, supporting application of those tools
CI
Thermal considerations
Embedded Applications differ from the typical desktop, server and mobile markets. Some of the different
requirements for embedded applications include higher ambient temperatures, need for higher max
component temperature spec, low platform power, long life support, small form factors, and extended
usage conditions (24 x 7 x 365 operation). Due to these differences there are special considerations for
CITSTUDENTS.IN
Page 48
EMBEDDED SYSTEMS
10EE665
component and system level thermal solution design. Thermal solution design requires an engineer to
fully understand the system and various form factor boundary conditions and component level attributes.
This document will define thermal cooling schemes: passive, active and fan less thermal solutions and
their difference via the three modes of heat transfer (conduction, convection, and radiation). The thermal
performance metrology will be explained, using a thermal resistance calculation and how to apply to Intel
components. The methodology will highlight typical Intel component specifications such as TJ -MAX,
TCASE-MAX, TAMBIENT and Thermal Design Power (TDP). In addition some thermal features such
TS
.IN
as the Digital Thermal Sensor (DTS) and Thermal Monitor will be explained.
Computing platform component power has decreased as a result of silicon technology improvement.
However, it is still critical to cool the components to adequately ensure a products long-life reliability. In
embedded applications, there are challenges which are more demanding than the general computing
systems such as desktops, notebooks, and workstations/servers. The major differences are the target usage
model and operating environment. Typically, embedded applications are in harsh environments, such as
EN
outdoors, factory assembly lines, and telecomm base stations. Conversely, the usual desktop, mobile, and
workstation/ server are typically deployed in homes, offices, and data centers where there are controlled
environmental conditions.
TU
D
Intel provides a wide variety of embedded processors and chipsets that have features and specifications
that are suited for embedded markets. These components typically have high maximum temperatures
limits, long life availability and features such as Digital Thermal Sensor and Enhanced Intel SpeedStep
Technology. All of these features will aid the embedded thermal engineer in designing robust thermal
solutions for Intel Architecture.
TS
Cooling Methods
CI
There are three basic types of thermal solutions for electronics cooling: passive thermal
solutions, active thermal solutions and fan less thermal solutions. The type of cooling solution
used in an embedded system will vary depending on the form factor, component specifications,
and boundary conditions. All thermal solutions rely on the three modes of heat transfer to
dissipate the heat from the component: conduction, convection and radiation.
CITSTUDENTS.IN
Page 49
EMBEDDED SYSTEMS
10EE665
TS
.IN
Convection
Convection is the transfer of thermal energy between two surfaces as a consequence of a relative
velocity between them. The most practical application is where one surface is a solid and the
other is a fluid.
EN
Radiation
Radiation cooling is the transfer of heat by electromagnetic emission, primarily in the infrared
TU
D
wavelengths. While the transfer of energy by conduction and convection requires the presence of
a material medium, radiation does not. In fact, radiation transfer occurs most effectively in a
vacuum.
TS
An active thermal solution is a heat sink that incorporates a fan attached directly to it. This is the
CI
most common type of thermal solution for desktop computers. In general embedded applications
do not use this type of thermal solution. These solutions usually require more height above the
motherboard than embedded form factors can provide.
Passive thermal solutions are the most common type of thermal solution for embedded
applications. This type of thermal solution employs a solid metal heat sink attached to the heat
CITSTUDENTS.IN
Page 50
EMBEDDED SYSTEMS
10EE665
dissipating component and then with system airflow the heat is removed. Since the airflow is
provided by system fan(s), the velocity tends to be much lower than that of an active heat sink,
resulting in a lower convection heat transfer coefficient. There could be obstacles, like
motherboard components, that are placed between the system fan and the passive heat sink,
which creates a resistance to the forced air flow from system fan. In turn, this usually requires a
larger heat sink to achieve the same performance, since the thermal solution must rely on more
conductive heat transfer. The advantage of passive thermal solutions is that they can be used in
TS
.IN
form factors where the z-height above the motherboard is limited. In some usage models, the
fans are grouped into an easily removable tray fastened to the system chassis air inlet, which
allows for swapping of defective fan(s) from the system chassis.
EN
A fan less thermal solution refers to a solution that does not use a fan (system or component
level) to provide airflow. The only airflow is induced by the buoyancy effect where hot air
moves opposite the direction of gravity and cool air moves towards the direction of gravity. This
CI
TS
TU
D
air movement is created by the difference in air density and the resulting velocity is very low.
CITSTUDENTS.IN
Page 51
EMBEDDED SYSTEMS
10EE665
PART B
UNIT - 5 & 6
systems, Programming concepts and embedded programming in C, Round Robin, Round Robin
with interrupts, function queue-scheduling architecture, Real time OS architecture, selecting
TS
.IN
Real-time programming has always been one of the most challenging programming disciplines.
Real-time
programming
requires
comprehensive
command
of
sequential
programming,
EN
concurrency, and, of course, time. Real-time programming has many application domains. In this
chapter, however, we structure our discussion around digital control systems for the following
two reasons. Firstly, digital control systems represent a large portion of real-time software in a
TU
D
diverse set of industries. Examples include automotive power train control systems, aircraft ight
control systems, electrical drive systems in paper mills, or process control systems in power
plants and reneries.
Often real-
TS
time response times are understood to be in the order of milliseconds and sometimes
microseconds. In contrast, a non-real-time system is one that cannot guarantee a response time in
any situation, even if a fast response is the usual result.
CI
confused with the two other legitimate uses of 'real-time'. In the domain of simulations, the term
means that the simulation's clock runs as fast as a real clock would; and in the domain of data
transfer, media processing and enterprise systems, the term is used to mean 'without perceivable
delay'.
Real-time software may use one or more of the following: synchronous programming
languages, real-time operating systems, and real-time networks, each of which provide essential
frameworks on which to build a real-time software application. A real-time system may be one
where its application can be considered (within context) to be mission critical. The anti-lock
brakes on a car are a simple example of a real-time computing system the real-time constraint
CITSTUDENTS.IN
Page 52
EMBEDDED SYSTEMS
10EE665
in this system is the time in which the brakes must be released to prevent the wheel from locking.
Real-time computations can be said to have failed if they are not completed before their deadline,
where their deadline is relative to an event. A real-time deadline must be met, regardless
of system load.
Developing applications for such systems requires programming languages and abstractions
which are substantially different from those used for developing desktop applications. The aim of
this module is to introduce different real-time programming models and programming languages
TS
.IN
Operating Systems
Operating system consists of a set of programs (software) that manages the hardware and
provides an environment to run multiple application programs. The OS shares the hardware
TU
D
EN
(CPU, Memory, I/O controllers and I/O devices) among multiple application programs.
Operating system (OS) is not a single program; it is a set of programs. However the real core of
an operating system is called Kernel. The second important program of an OS is User Interface
(UI) program. Old operating systems used to have only Command Line user Interface (CLI)
TS
program called Shell. But all modern operating systems are coming with Graphical User
Interfaces (GUI) called Windows. All the other programs that come with the OS are utility
CI
application programs.
CITSTUDENTS.IN
Page 53
10EE665
TS
.IN
EMBEDDED SYSTEMS
EN
The set of programs that comes with OS, and which we call OS is shown inside the dashed lines.
The most important part of the OS is the Kernel. But just kernel alone is not enough. So OS
comes with two types of user interface programs. One is graphics based and other is command
TU
D
(or text) based. Besides these user interface programs, OS also includes many utility programs,
to create and list file, directories.
Following are the typical services provided by the Kernel to the system applications:
TS
File Services
I/O Services
CI
Multi-processing services
Multi-threading services
Memory allocation and mapping services
Signal/Event services
Inter Process Communication and Synchronization services
Time services
Network communication services
CITSTUDENTS.IN
Page 54
EMBEDDED SYSTEMS
10EE665
Kernel has got the following main responsibilities for the programs:
CI
TS
TU
D
EN
TS
.IN
memory
CITSTUDENTS.IN
Page 55
EMBEDDED SYSTEMS
10EE665
TS
.IN
File Services
Using the file services one can write a program to do the following things:
EN
Reading the attributes (details such size, owner, permissions etc..) of a file
TU
D
Deleting a file
Changing the attributes of file
TS
CI
I/O Services
Using the file services one can write a program to do the following things:
Page 56
EMBEDDED SYSTEMS
10EE665
TS
.IN
It gives a precise control of the processor internal devices and full use of processor
specific features in its instruction set and its addressing modes.
The machine codes are compact. This is because the codes for declaring the conditions,
rules, and data type do not exist. The system thus needs a smaller memory. Excess
memory needed does not depend on the programmer data type selection and ruledeclarations. It is also not the compiler specific and library functions specific.
EN
Device driver codes may need only a few assembly instructions. For example, consider a
small embedded system, a timer device in a microwave oven or an automatic washing
machine or an automatic chocolate vending machine. Assembly codes for these can be
CI
TS
TU
D
CITSTUDENTS.IN
Page 57
EMBEDDED SYSTEMS
10EE665
It becomes convenient to develop the source files in C or C++ or Java for complex systems
because of the following advantages of high-level languages for such systems.
The development cycle is short for complex systems due to the use of functions
(procedures), standard library functions, modular programming approach and top down
TS
.IN
design. Application programs are structured to ensure that the software is based on sound
software engineering principles.
EN
well tested. It must have a well-defined goal and the well-defined data inputs and
outputs. It should have only one calling procedure. There should be one return
point from it. It should not affect any data other than that which is targeted. [Data
Encapsulation] It must return (report) error conditions encountered during its
TU
D
execution.
o Bottom up design is a design approach in which programming is first done for the
sub modules of the specific and distinct sets of actions. An example of the
modules for specific sets of actions is a program for a software timer, RTCSWT::
TS
run. Programs for delay, counting, finding time intervals and many applications
can be written. Then the final program is designed. The approach to this way of
designing a program is to first code the basic functional modules and then use
CI
Data type declarations provide programming ease. For example, there are four types of
integers, int, unsigned int, short and long. When dealing with positive only values, we
declare a variable as unsigned int. For example, numTicks (Number of Ticks of a clock
before the timeout) has to be unsigned. We need a signed integer, int (32 bit) in
CITSTUDENTS.IN
Page 58
EMBEDDED SYSTEMS
10EE665
arithmetical calculations. An integer can also be declared as data type, short (16 bit) or
long (64 bit). To manipulate the text and strings for a character, another data type is char.
Each data type is an abstraction for the methods to use, to manipulate, to represent, and
for a set of permissible operations.
Type checking makes the program less prone to error. For example, type checking does
TS
.IN
not permit subtraction, multiplication and division on the char data types. Further, it lets
+ be used for concatenation. [For example, micro + controller concatenates into
microcontroller, where micro is an array of char values and controller is another array of
char values.]
Control Structures (for examples, while, do - while, break and for) and Conditional
path design tasks simple.
EN
Statements (for examples, if, if- else, else - if and switch - case) make the program-flow
TU
D
Portability of non-processor specific codes exists. Therefore, when the hardware changes,
only the modules for the device drivers and device management, initialization and locator
CI
TS
CITSTUDENTS.IN
Page 59
EMBEDDED SYSTEMS
10EE665
1. It is a language between low (assembly) and high level language. Inserting the assembly
language codes in between is called in-line assembly. A direct hardware control is thus also
feasible by in-line assembly, and the complex part of the program can be in high-level language.
TS
.IN
The C program elements, header and source files and preprocessor directives are as follows:
Any C program first includes the header and source files that are readily available.
# include vxWorks.h /* Include VxWorks functions*/
EN
TU
D
TS
# include prctlHandlers.c /* Include file for the codes for handling and actions as per the
CI
Include is a preprocessor directive to include the contents (codes or data) of a file. The files that
can be included are given below. Inclusion of all files and specific header files has to be as per
requirements.
Including Codes Files: These are the files for the codes already available. For example, #
include prctlHandlers.c.
CITSTUDENTS.IN
Page 60
EMBEDDED SYSTEMS
10EE665
Including Constant data Files: These are the files for the codes and may have the
extension.const.
Including Stings data Files: These are the files for the strings and may have the extension
.strings or .str. or .txt. For example, # include netDrvConfig.txt
Including initial data Files:
There are files for the initial or default data for the shadow
ROM of the embedded system. The boot-up program is copied later into the RAM and
TS
.IN
may have the extension .init. On the other hand, RAM data files have the extension,
.data.
Including basic variables Files: These are the files for the local or global static variables
that are stored in the RAM because they do not posses the initial (default) values. The
static means that there is a common not more than one instance of that variable address
and it has a static memory allocation. There is only one real time clock, and therefore
with the extension .bss.
EN
only one instance of that variable address. These basic variables are stored in the files
Including Header Files: It is a preprocessor directive, which includes the contents (codes
TU
D
or data) of a set of source files. These are the files of a specific module. A header file has
the extension .h. Examples are as follows. The string manipulation functions are needed
in a program using strings. These become available once a header file called string.h is
included. The mathematical functions, square root, sin, cos, tan, atan and so on are
needed in programs using mathematical expressions. These become available by
TS
including a header file, called math.h. The pre-processor directives will be # include
CI
Also included are the header files for the codes in assembly, and for the I/O operations (conio.h),
for the OS functions and RTOS functions. # include vxWorks.h is directive to compiler, which
includes VxWorks RTOS functions.
Note: Certain compilers provide for conio.h in place of stdio.h. This is because embedded
systems usually do not need the file functions for opening, closing, read and write. So when
including stdio.h, it makes the code too big.
CITSTUDENTS.IN
Page 61
EMBEDDED SYSTEMS
10EE665
What is the difference between inclusion of a header file, and a text file or data file or constants
file?
TS
.IN
EN
Source files
Source files are program files for the functions of application software. The source files need to
be compiled. A source file will also possess the preprocessor directives of the application and
TU
D
have the first function from where the processing will start. This function is called main function.
Its codes start with void main ( ). The main calls other functions. A source file holds the codes as
like the ones given earlier.
TS
Configuration files
Configuration files are the files for the configuration of the system. Recall codes in Lines.
Device configuration codes can be put in a file of basic variables and included when needed. If
CI
these codes are in the file serialLine_cfg.h then # include serialLine_cfg.h will be
preprocessor directive. Consider another example. I# include os_cfg.h. It will include os_cfg
header file.
Preprocessor Directive
A preprocessor directive starts with a sharp (hash) sign. These commands are for the following
directives to the compiler for processing.
CITSTUDENTS.IN
Page 62
EMBEDDED SYSTEMS
10EE665
variable of boolean data type and is volatile. [Volatile is a directive to the compiler not to
take this variable into account while compacting and optimising the codes.] IntrDisable,
IntrPortAEnable, IntrPortADisable, STAF and STAI are the other global variables.
TS
.IN
Strings can also be defined. Strings are the constants, for example,
EN
TU
D
corresponding codes for it at every place where that macro name appears.
Whenever a data is named, it will have the address(es) allocated at the memory. The number of
TS
addresses allocated depends upon the data type. C allows the following primitive data types.
The char (8 bit) for characters, byte (8 bit), unsigned short (16 bit), short (16 bit), unsigned int
(32 bit), int (32 bit), long double (64 bit), float (32 bit) and double (64 bit). [Certain compilers do
CI
not take the byte as a data type definition. The char is then used instead of byte. Most C
compilers do not take a Boolean variable as data type. As in second line of typedef is used to
create a Boolean type variable in the C program.] A data type appropriate for the hardware is
used. For example, a 16-bit timer can have only the unsigned short data type, and its range can
be from 0 to 65535 only. The typedef is also used. It is made clear by the following example. A
compiler version may not process the declaration as an unsigned byte. The unsigned character
can then be used as a data type. It can then be declared as follows:
CITSTUDENTS.IN
Page 63
EMBEDDED SYSTEMS
10EE665
Round-Robin
Round-robin (RR) is one of the simplest scheduling algorithms for processes in an operating
TS
.IN
system. As the term is generally used, time slices are assigned to each process in equal portions
and in circular order, handling all processes without priority (also known as cyclic executive).
Round-robin
scheduling
is
simple,
easy
to
implement,
and starvation-free.
Round-robin
scheduling can also be applied to other scheduling problems, such as data packet scheduling in
computer networks.
EN
TU
D
In the absence of time-sharing, or if the quanta were large relative to the sizes of the jobs, a
process that produced large jobs would be favoured over other processes.
Example: If the time slot is 100 milliseconds, and job1 takes a total time of 250 ms to complete,
TS
the round-robin scheduler will suspend the job after 100 ms and give other jobs their time on the
CPU. Once the other jobs have had their equal share (100 ms each), job1 will get another
allocation of CPU time and the cycle will repeat. This process continues until the job finishes
CI
CITSTUDENTS.IN
Page 64
EMBEDDED SYSTEMS
10EE665
Another approach is to divide all processes into an equal number of timing quanta such that the
quantum size is proportional to the size of the process. Hence, all processes end at the same time.
Round-Robin with Interrupts
Interrupt routines deal with the very urgent needs of devices Interrupt routines set flags to
indicate the interrupt happened main while loop polls the status of the interrupt flags and does
EN
TS
.IN
TU
D
TS
CI
Context problems can occur saving and restoring context inside interrupts routines
becomes necessary when number of registers/resources is small.
Page 65
EMBEDDED SYSTEMS
10EE665
main task code has to call the functions in the order that the interrupt occurred. It can call them
based on any priority scheme of your choosing.
response can be executed earlier. All you need is some coding in the routines that queue up the
function pointers.
TS
.IN
And state that the appropriate data-handling function needs to be executed soon.
EN
TU
D
RTOS Architecture
The architecture of an RTOS is dependent on the complexity of its deployment. Good RTOSs are
scalable to meet different sets of requirements for different applications. For simple applications,
an RTOS usually comprises only a kernel. For more complex embedded systems, an RTOS can
be a combination of various modules, including the kernel, networking protocol stacks, and other
TS
CI
CITSTUDENTS.IN
Page 66
EMBEDDED SYSTEMS
10EE665
Ke rne l
An operating system generally consists of two parts: kernel space (kernel mode) and user space
(user mode). Kernel is the smallest and central component of an operating system. Its services
include managing memory and devices and also to provide an interface for software applications
to use the resources. Additional services such as managing protection of programs and
Monolithic kernel
TS
.IN
multitasking may be included depending on architecture of operating system. There are three
It runs all basic system services (i.e. process and memory management, interrupt handling and
I/O communication, file system, etc) in kernel space. As such, monolithic kernels provide rich
EN
and powerful abstractions of the underlying hardware. Amount of context switches and
messaging involved are greatly reduced which makes it run faster than microkernel. Examples
TU
D
CI
TS
Microkernel
It runs only basic process communication (messaging) and I/O control. The other system services
(file system, networking, etc) reside in user space in the form of daemons/servers. Thus, micro
CITSTUDENTS.IN
Page 67
EMBEDDED SYSTEMS
10EE665
kernels provide a smaller set of simple hardware abstractions. It is more stable than monolithic as
the kernel is unaffected even if the servers failed (i.e.File System). Examples are AmigaOS and
QNX.
TU
D
EN
TS
.IN
Introduction to RTOS
TS
RTOS stands for Real time operating systems as the name suggests, there is a deadline associated
with tasks and an RTOS adheres to this deadline as missing a deadline can cause affects ranging
from undesired to catastrophic As discussed above that the embedded systems are becoming
CI
more and more complex today and with each passing generation their intrusion in our daily lives
will become deeper. This means they will bear more and more responsibilities on their shoulders
to solve real time problems to make our life easier. But, this requires more and more complex
real time applications that RTOS will have to manage effectively.
LynxOS
OSE
CITSTUDENTS.IN
Page 68
EMBEDDED SYSTEMS
QNX
RTLinux
VxWorks
Windows CE
10EE665
TS
.IN
Classification of RTOS
Hard RTOS: These type of RTOS strictly adhere to the deadline associated with the
tasks. Missing on a deadline can have catastrophic affects. The air-bag example we
deadline there could cause a life.
EN
Firm RTOS: These type of RTOS are also required to adhere to the deadlines because
TU
D
missing a deadline may not cause a catastrophic affect but could cause undesired affects,
like a huge reduction in quality of a product which is highly undesired.
Soft RTOS: In these type of RTOS, missing a deadline is acceptable. For example Online Databases.
TS
Features of RTOS
An RTOS must be designed in a way that it should strike a balance between supporting a rich
CI
feature set for development and deployment of real time applications and not compromising on
Context switching latency should be short. This means that the time taken while saving
the context of current task and then switching over to another task should be short.
CITSTUDENTS.IN
Page 69
EMBEDDED SYSTEMS
10EE665
The time taken between executing the last instruction of an interrupted task and executing
the first instruction of interrupt handler should be predictable and short. This is also
known as interrupt latency.
Similarly the time taken between executing the last instruction of the interrupt handler
and executing the next task should also be short and predictable. This is also known as
interrupting dispatch latency.
TS
.IN
Reliable and time bound inter process mechanisms should be in place for processes to
communicate with each other in a timely manner.
An RTOS should have support for multitasking and task preemption. Preemption means
to switch from a currently executing task to a high priority task ready and waiting to be
executed.
Real time Operating systems but support kernel preemption where-in a process in kernel
CI
TS
TU
D
EN
CITSTUDENTS.IN
Page 70
EMBEDDED SYSTEMS
10EE665
UNIT - 7 & 8
Subsystem interfacing with external systems user interfacing, Serial I/O devices, Parallel port
interfaces:Input switches, Key boards and Memory interfacing.
Case study: Embedded velocity PID controller, PI controller with a PWM actuator.
TS
.IN
Serial I/O
Any input or output that comprises a byte, word, or longer stream that's shifted into or out of the
system a single bit at a time. Serial I/O is used mostly for data communications. It's cheaper to
run a few wires between remote devices than a parallel bus, especially since noise considerations
usually mandate level shifters on each line. But even within a computer, some serial I/O is not
unusual: the I2C bus often connects several processors on a single PCB, and serial EEPROMs
EN
are widely used to store MAC addresses and other nonvolatile data
TU
D
RS-232C
An EIA standard that defines a commonly used serial communications scheme. RS -232C is
widely used to transfer data between computers or other devices using an asynchronous serial
link at speeds ranging from 110 to 115,200 baud. The standard defines connectors, signals, signal
levels, and typical handshake.
TS
A 'space' (logic 0) ranges from +3 to +25 V; 'marks' (1s) are -3 to -25 V. Unfortunately, the
standard permits a wide range of connections and handshaking. As a result, the two RS -232C
CI
devices you're trying to connect might may not plug and play
RS-422
An EIA standard that defines a serial communications scheme designed for sending data over
long distances
in noisy environments.
communications link using differential signals. Two wires each are used for transmission and
reception. Polarity of the signal defines 1s and 0s: a voltage of +200 mV to +6 V is 1 ('mark'); -
CITSTUDENTS.IN
Page 71
EMBEDDED SYSTEMS
10EE665
200 mV to -6 V is a 0 ('space'). RS-422 supports data rates to 10 Mbps over cables up to 1200
meters long
TS
.IN
similar manner.
Example: A bank of LEDs connected to a computer generally interface on one or more parallel
ports.
EN
Input switches
An input device that can take any one of two or more values. Most switches are binary: either
TU
D
open or closed.
TS
A group of switches, usually SPST, in a dual inline package. DIP switches, available in throughhole and SMT configurations, offer lots of switches in a very small and very cheap package.
They're not meant for applications requiring lots of switching; most often, they are used to set up
CI
When you press a key on your computer, you are activating a switch. There are many different
ways of making these switches. An overview of the construction and operation of some of the
most common types.
CITSTUDENTS.IN
Page 72
EMBEDDED SYSTEMS
10EE665
In mechanical-switch keys, two pieces of metal are pushed together when you press the key. The
actual switch elements are often made of a phosphor-bronze alloy with gold platting on the
contact areas. The key switch usually contains a spring to return the key to the nonpressed
position and perhaps a small piece of foam to help damp out bouncing.
TS
.IN
Some mechanical key switches now consist of a molded silicon dome with a small piece of
conductive rubber foam short two trace on the printed-circuit board to produce the key pressed
signal.
Mechanical switches are relatively inexpensive but they have several disadvantages.
First, they suffer from contact bounce. A pressed key may make and break contact
EN
Second, the contacts may become oxidized or dirty with age so they no longer make a
TU
D
dependable connection.
Higher-quality mechanical switches typically have a rated life time of about 1 million
keystrokes. The silicone dome type typically last 25 million keystrokes.
TS
These switches are really a special type of mechanical switches. They consist of a three-layer
CI
The top layer has a conductive line of silver ink running under each key position. The
bottom layer has a conductive line of silver ink running under each column of keys.
When you press a key, you push the top ink line through the hole to contact the bottom
ink line. The advantages of membrane keyboards is that they can be made as very thin,
sealed units.
CITSTUDENTS.IN
Page 73
EMBEDDED SYSTEMS
10EE665
They are often used on cash registers in fast food restaurants. The lifetime of membrane
keyboards varies over a wide range.
A capacitive key switch has two small metal plates on the printed circuit board and another metal
TS
.IN
When you press the key, the movable plate is pushed closer to fixed plate. This changes the
capacitance between the fixed plates. Sense amplifier circuitry detects this change in capacitance
and produce a logic level signal that indicates a key has been pressed. The big advantages of a
capacitive switch is that it has no mechanical contacts to become oxidized or dirty. A small
disadvantage is the specified circuitry needed to detect the change in capacitance. Capacitive key
TU
D
EN
This is another type of switch which has no mechanical contact. It takes advantage of the
deflection of a moving charge by a magnetic field.
TS
faces. When a key is pressed, the crystal is moved through a magnetic field which has its
CI
Moving the crystal through the magnetic field causes a small voltage to be developed
between two of the other opposing faces of the crystal.
This voltage is amplified and used to indicate that a key has been pressed. Hall effect sensors are
also used to detect motion in many electrically controlled machines.
CITSTUDENTS.IN
Page 74
EMBEDDED SYSTEMS
10EE665
Hall effect keyboards are more expensive because of the more complex switch
mechanism, but they are very dependable and have typically rated lifetime of 100 million
or more keystrokes.
The following flow chart for a procedure to detect, debounce and produce the hex code for a
pressed key.
An easy way to detect if any key in the matrix is pressed is to output 0s to all rows and
TS
.IN
then check the column to see if a pressed key has connected a low to a column.
In the algorithm we first output lows to all the rows and check the columns over and over
until the column are all high. This is done before the previous key has been released
before looking for the next one. In the standard keyboard terminology, this is called two-
CI
TS
TU
D
EN
key lockout.
CITSTUDENTS.IN
Page 75