Вы находитесь на странице: 1из 46

1

1. Introduction
to Embedded
System
7. Interrupts,
Delays, and
Semaphores
with ChibiOS

6. ChibiOS
Real Time
Operating
System

2. The
Human and
Physical
Interfaces

Embedded
System and
Applications
BNF 30603

5. Real Time
Operating
System

4. Interrupts,
Delays, and
Multitasking

3. Serial
Interfaces,
Timer, Data
Acquisition and
Manipulation

Review: Embedded Systems vs General Purpose Computer


The Human and Physical Interfaces
Switch
Keypad
LED Displays

Liquid Crystal Displays


Some Simple Sensors
Digital Input Characteristics
Actuators: Motors and Servos
Interfacing to Actuators
3

A
microprocessor
Operating
System

Networking
unit

A
computer
has..

Large memory
RAM, ROM, HDD

I/O
units
5

An embedded system also has the


same structure but at a smaller size
6

A system whose principal function is not computational, but which

is controlled by a computer embedded within it [1]


Embedded systems are information processing systems that are

embedded into a larger product and are normally not directly


visible to the users [5]
Any device that includes a programmable computer but not itself

intended to be a general-purpose computer [3]

Because most devices need control system!


These control systems are embedded within the device, usually

unrecognizable
Embedded systems are everywhere
Millions units are produced yearly for various purposes, vs millions
of desktop units

The observation that the number of transistors in a dense integrated circuit doubles

approximately every two years. The observation is named after Gordon E. Moore,
the co-founder of Intel and Fairchild Semiconductor.

The Derbot AGV


Derbot AGV Block Diagram

10

Digital Camera Block Diagram

11

HOME

OFFICE AND
COMMERCE

MOTOR CAR

Washing machine

Photocopier

Door mechanism

Fridge

Checkout machine

Brake system

Burglar alarm

Printer

Engine control

Microwave oven

Scanner

In-car entertainment

Central heating
controller

Climate control

Toys and games


12

Source: tech.ubm.com

13

GENERAL PURPOSE

EMBEDDED

Intended to run a fully general set of


applications
End-user programmable

Runs a few applications often known


at design time
Not end-user programmable

Faster is always better

Operates in fixed run-time constraints,


additional performance may not be
useful/valuable

Differentiating features:
Speed (need not be fully predictable)
Software compatibility
Cost (e.g. RM3k vs RM5k per laptop)

Differentiating features:
Power
Cost (e.g. RM100 vs RM200)
Size
Speed (must be predictable)
14

MicroP
A chip that contains only the
processor need other chips to
make a working system
More flexible
Can have very few I/O or many I/O
devices using the same processor
Used as general-purpose processor
when large embedded software has
to be located in the external
memory chips

MicroC
A chip that contains all the
components of a computer
processor, memory, I/O
Less flexibility
Less component count
Less powerful
Used when a small or part of the
embedded software has to be
located in the internal memory and
when on-chip functional units such
as interrupt-handler, timer, etc. are
required

15

Connected to
physical
environment
through sensors
and actuators

Have to be dependable
Reliability will not fail
Maintainability can repair
Availability reliable + maintainable
Safety fail, will not cause any harm
Security secured data

Reactive systems

Idle

N
Input?
Y
Execute
task

Dedicated towards a
certain application
extra program
makes the system
less dependable

Dedicated user
interface push
buttons, pedals,
steering wheels

COMMON CHARACTERISTICS
OF EMBEDDED SYSTEMS

Hybrid systems
include analog
and digital parts

cost

Real-time constraints
Hard
Soft
Firm

Have to be
efficient

energy

codesize

runtime

weight
16

1. Hard RTS
Failure to meet even a single deadline may lead to complete catastrophic
system failure
2. Soft RTS
Performance is degraded but not destroyed by failure to meet responsetime constraint
3. Firm RTS
Few missed deadlines will not lead to total failure, but missing more than
a few may lead to complete or catastrophic system failure
17

Example:
1. Air Traffic Control: a service provided by ground-based controllers who direct

aircraft on the ground and through controlled airspace, and can provide advisory
services to aircraft in non-controlled airspace. The primary purpose of ATC
worldwide is to prevent collisions, organize and expedite the flow of traffic, and
provide information and other support for pilots.
2. Car Engine Management Control

3. Pacemaker: a small device that's placed in the chest or abdomen to help control

abnormal heart rhythms. This device uses electrical pulses to prompt the heart
to beat at a normal rate.
4. Fire Alarm System
18

Example:
1. Automatic Washing machine
2. Air-conditioning
3. CD Player

19

Example:
1. Music Sound System in the computer
2. Door Bell Ringing System

20

Find two examples of hard, soft and firm real-time embedded system in:
1. Automotive
2. Home Appliances
3. Industrial Automation / Food Industry
4. Medical System

21

Decreasing one may


increase another

Unit cost: the monetary cost of manufacturing each copy of the system, excluding NRE cost.
NRE cost (Non-Recurring Engineering cost): The monetary cost of designing the system. Once the system

is designed, any number of units can be manufactured without incurring any additional design cost
(hence the term non-recurring).
Size: the physical space required by the system, often measured in bytes for software, and gates or

transistors for hardware.


Performance: the execution time or throughput of the system.

Power: the amount of power consumed by the system, which determines the lifetime of a battery, or

the cooling requirements of the IC, since more power means more heat.
22

23

Embedded computer reads signals, outputting control signals, interact

with human user and possibly interact with an external system via
network
Input devices sensors for measurement or data entry devices for

human interaction
Output devices - displays or alarms, and motors or actuators for the

physical system

24

25

Extensively used in embedded systems.


Need to convert the switch position to a logic level that can be read by a

microcontroller port bit.


Switches are used as direct user interface in the form of push-buttons,

toggle switches, slide switches, etc.

Connecting switch to logic input

26

Allows numeric or

alphanumeric information
to be entered.
It is widely used in

photocopiers, burglar
alarms, central heating
controllers.
Arranged in a 4 3

matrix, with four rows


and three columns

Keypad with pull-up resistors


27

Reading a keypad with a microcontroller port (a) Flow diagram (b) Outputs for keypad

28

LEDs made of gallium

arsenide (GaAs) emit light


in the infrared, and if
phosphorus is added in
increasing proportions,
the light moves to visible
red and ultimately to
green.
Driving LEDs from logic gates. (a) Gate output sourcing
current to LED (b) Gate output sinking current
from LED
29

There are eight LEDs in the digit (including the decimal point), but instead of 16

connections being needed, only nine is enough, one for each segment and one for the
common connection. The actual pin connections in the example shown lie in two rows, at
the top and bottom of the digit. There are 10 pins in all, with the common anode or
cathode taking two pins.

30

Control is exercised by three control lines:

Register Select (RS), which determines


whether an instruction or character data is
being transferred

Read/Write (R/W), which determines data


direction
Enable (E), which provides a clock function
to synchronise data transfer.
The user can access two registers, depending

on the state of the RS line:


An instruction register, used to transfer
instructions (RS = 0)
A data register, used to transfer display data,
for example character codes (RS = 1).

31

Large range of sensors available

today, which includes smart or


intelligent sensors, which are
integrated onto an IC and have
on-chip signal processing
Microswitch mechanical

position sensing
Some of Derbots sensors and actuators

32

Light-dependent

resistors (LDR)
made from a piece of exposed
semiconductor material. When light
falls on it, it creates holeelectron
pairs in the material, which improve
the conductivity. When light is
removed, the holeelectron pairs
recombine and conductivity falls. The
overall effect is that as illumination
increases, the LDR resistance falls.
33

Optical methods are very useful in sensing objects and surfaces. In one

configuration the presence of an object can be sensed if it breaks a light


beam, in another if it reflects the beam.

The reflective optical sensor (a) Principle of operation (b) Electrical connection

34

Widely used for sensing and measurement, from simple distance

measurement to complex medical imaging. The Derbot AGV uses an


ultrasonic reflective sensor to detect obstacles in its path or to allow it to
run parallel to a wall.
The sensor consists of a transmitter and receiver and, to the extent that it is

based on a reflective principle, is initially similar to the reflective opto-sensor.


The big difference lies in the fact that the ultrasound source is pulsed and the

time taken for the echo to return is measured; from this a distance can be
calculated.

35

If a microcontroller is to receive logic signals, then it is essential that those

signals are at voltage levels which are recognized by it as being either Logic
0 or Logic 1
These voltage levels are usually defined by logic family, for example TTL

(Transistor Transistor
Semiconductor)

Logic)

or

CMOS

(Complementary

Metal

Oxide

When one device is connected to another, and each is supplied by the same

voltage and is of the same logic family, then it is usually safe to assume that logic
levels will be safely and reliably transferred
However, if signals are generated from a non-logic source, e.g. a sensor, or if they

have been received over a long communication link, or have been subject to
interference, then it may be that they are not correctly interpreted by the
36
receiver

Port bit input voltage levels, 5V supply

37

Different forms of signal corruption. (a) Spikes in signal, potentially harmful to device input.
(b) Spikes in signal. (c) Excessively slow edges. (d) DC offset in signal
38

Clamping voltage spikes with current-limiting resistor


Schmitt trigger
Analog input filtering
Opto-isolation
Digital input filtering

39

To cause physical movement - linear, i.e. movement in a straight


line, or rotary
Solenoids for linear movement
Servos for angular movement only
DC and stepper motor for angular or rotary
Pneumatic and hydraulic for high forces

40

Both can be used for continuous rotary motion or for precise


angular displacement
DC motors - range from the extremely powerful to the very small.
DC motors drive huge electric trains, but also drive tiny
mechatronic systems
Stepper motors - ability to interface very directly with a digital
system. Each digital pulse sent to a stepper controller can be
used to advance the motor shaft position by a known angle

41

Simple DC Switching
Only very small electrical loads, like LEDs, can be driven
directly by a microcontroller port bit. Larger loads, drawing
beyond 10 or 20 mA, or powered from a voltage higher than
the logic supply voltage, need to be interfaced via power
switching devices
Transistor switches provide an easy way of switching DC loads
MOSFET and bipolar

42

Simple DC Switching

Transistor switching of DC loads.


(a) Resistive, bipolar transistor. (b)
Resistive, MOSFET. (c) Inductive,
MOSFET

43

Reversible switching: the H-bridge


Some loads, however, for example DC or stepper motors,
need to have a reversible voltage applied, even if only a
unipolar supply voltage is available. The way this is usually
achieved is by a simple yet ingenious circuit connection called
the H-bridge
Two pairs of switching devices, usually transistors, are
connected between supply rail and 0V
Each pair has a high-side and a low-side switch

44

Reversible switching: the H-bridge

The principle of the H-bridge


45

Serial Interfaces
SPI, I2C, USART, USB

Timer
Data Acquisition and Manipulation

46

Вам также может понравиться