CPE 509 Lecture Note Power Point Presentation
CPE 509 Lecture Note Power Point Presentation
CPE 509 Lecture Note Power Point Presentation
Introduction
to
Embedded
System
Department
1
of Computer Engineering
University of Maiduguri
CPE 509: EMBEDDED SYSTEMS
Introduction
Embedded microcontroller – timers, ADC,
DACs (I/Os)
Embedded microprocessors – memory
2
INTRODUCTION:
Embedded systems are either electronic/ electrical/
electromechanical system that contain a
microprocessor or microcontroller but are not thought
of as a computer because the computer is embedded
in the system. Embedded systems can be found in lot
of things ranging from household materials like baby
toys, mini-robots, rice cookers, bread toasters, food
processor, television and mobile phones to industrial
appliances like process controllers, power generating
stations, manufacturing industries, automobiles,
instrumentation, network routers, telecommunication
systems, air-traffic controllers, avionic system,
defense systems, medical equipments and many
more. Small in size, cheaper cost and low power are 3
for ES while computer deals in processing power.
CHARACTERISTICS OF ES
4
CLASSIFICATION OF EMBEDDED
SYSTEMS
Embedded systems are classified into two
namely: embedded micro-controller and
embedded microprocessor. The first small
systems requiring a microprocessor is
deployed in use for small systems requiring
8 to 16 bit bus and usually applied for single
operation. On the other hand, embedded
microprocessor are used to refer to
microprocessors employed in large systems
of large than 16 bits bus and mainly for
industrial use with many things to control.
5
µcomputer
This is made up of µprocessor, memory
devices, I/O devices and the bus system
6
TYPICAL MICROCOMPUTER
µprocessor: This is called the central processing Unit (CPU). It
controls the system and processes data. When used in such a
way that it only performs one function at a time it is called
µprocessor. Moreso, if it performs only one function with the
capacity for change and made on a single chip, it is called
“single chip µcontroller”. However, it is can perform several
functions but one at a time, it is called “Expanded mode
µcontroller.
Memory devices: these stores data, address of data, the
results of processing and the instruction to be performed on the
data called CPU programs. Basically memory are RAM and ROM
but could also include external storage.
Input/output devices: These provides the interface between
the µprocessor and the outside world. It includes: keyboard,
monitor, mouse, speaker, µphone e.t.c.
The bus system: This is divided into two namely; the data bus
and the address bus. They provide for flexible interconnection in 7
between the other three units of the µcomputer.
SUMMARY
8
PIC INSTRUCTION SET
Simple instruction set: About 35 instructions
Instruction set grouped into 3 categories:
9
10
11
12
INSTRUCTIONS
EXAMPLES
Decrement a 16 bit counter
upper byte of the counter COUNTH and lower byte COUNTL
movf COUNTL, F; set Z if lower byte = 0
btfsc STATUS, Z ; if so, decrement COUNTH
decf COUNTH, F
decf COUNTH, F 18
decf COUNTL, F : decrement COUNTL
19
20
21
Using Relative Addressing
Table Loop-up :
mor/w 0 x 04 : Load w with 4
Call table : call the table subroutine
movwf result : store the result form the
table
peripheral interrupts
Bit oriented instructions can be used to
26
INTERRUPTS PROCESSING
When interrupt is responded to
GIE bit is cleared to disable other interrupts
PC is pushed into stack
PC is loaded with 0004h
Save STATUS and W register in temporary
memory location.
In the ISR, source of interrupt is determined by
polling the interrupt flag bit.
Return from interrupt instruction (retfic) exist
ISR, set GIE bit to allow pending interrupt to
execute.
27
INTERRUPT CONSTRAINTS
28
CRITICAL REGION
port D
Disabling interrupts by clearing GIE bit for the
required set of instructions.
29
PIC peripherals Digital I/O
postscalers
Can use oriented pins as clock in/clock out
PIC Timer/Timer O
8 bit timer/counter with prescaler
Synchronized Timer
Increment every instruction cycle
Synchronized counter
Timer increments on rising edge of external clock
External clock is synchronized with internal phase clock
Asynchronous counter 33
Timer increments independents of internal phase clock
PIC Timer: Timer 2
Readable and writeable
Interrupt on overflow
Watchdog Timer
Free running on chip RC oscillator which does not
wake –up
To avoid unintended device reset, postscaler has to
bit.
PIC Peripherals: CCP Modules- for Control App
Each module contains a 16 bit register which can operate
as 16 bit capture, 16-bit compare or as 10-bit PWM
master-slave duty cycle register.
Capture counts external pin changes
Compare will interrupt when the time equals the value in
a compare register.
Capture
Capture mode records value of timer when events like
rising edge or falling edge occurs in pin CCPx
When capture is made, interrupt request flag bit is set.
Compare
Content of register is compared with timer 1 register pair
value 35
When match occurs, voltage level at CPPx pin is changed
depending on the value of control bits.
PWM
Pulse width modulation
“ON” voltage
Typical uses:
Intensity control
Motor control
Temperature control
PWM Mode
In pulse width modulation mode, CCPX pin produces up to a 10-
37
38
PIC peripheral: ADC
Converts an analog input signal to 8-bit/10 –bit digital
value
Generates results via successive approximation
Inputs analog channels, conversion clock and analog
reference voltage is software selectable
Can operate even while the device is in sleep mode
Can generate an interrupt on ADC conversion done
Result written on to ADRES register
devices or micro-controllers
Module operates in one of two modes:
40
In-circuit programmer
Serial in-circuit programming support
PIC: Examples
Low End: 12C508
8pin package (DIP)
12 bit core-33 instructions
1µsec instruction time (Tclk = 4MHz)
512 12bit program memory
25 8bit data memory or register (File register)
2 level hardware stack (no interrupts)
5 GPIO pins, 1 input only (25MA source/sink)
Features: internal pull-ups, wakeup on pin change, internal oscillation
Peripherals: Timer, and watchdog timer.