Professional Documents
Culture Documents
ENGINEERING COLLEGE
(An Autonomous Institution)
R.S.M. NAGAR, KAVARAPETTAI.
By:
Mr. R Babuji,
Assistant Professor,
Dept. of ECE/RMKEC
1 / 11
Contents
2 ARM Architecture
3 Instruction Set
2 / 11
Introduction to ARM
Popular Manufacturers of ARM
4 / 11
Add title here
5 / 11
What is ARM?
The ARM stands for Advanced RISC Machine and it is a 32-bit Reduced Instructions Set
Computer (RISC) microcontroller.
It was first introduced by the Acron computers’ organization in 1987.
ARM is the world’s leading provider of RISC based microprocessor solutions and other
semiconductor IP’s with more than 85 billion ARM based chips being shipped to date.
ARM doesn’t manufacture processors or other semiconductor devices but rather licenses
the semiconductor cores as Intellectual Property (IP) to other semiconductor companies
like ATMEL, Phillips (now NXP), Samsung etc.
6 / 11
ARM Introduction
• One of the most licensed and thus widespread processor cores in the
world.
Used in PDA, cell phones, multimedia players, handheld game
console, digital TV and cameras
• ARM7: GBA, iPod
• ARM9: NDS, PSP, Sony Ericsson, Ban
• ARM11: Apple iPhone, Nokia N93, N800
90% of 32-bit embedded RISC processors till 2009
Used especially in portable devices due to its
• low power consumption and reasonable performance
7 / 11
Why ARM?
8 / 11
Three architecture profiles: A, R and M.
A-Profile (Applications) R-Profile (Real-Time) M-Profile (Microcontroller)
Targeted at
High
systems with
performance. Small, highly
real-time
Designed to run a power-efficient
requirements.
complex devices..
Commonly found
operating system, Found at the heart
in networking
such as Linux or of many IoT
equipment, and
Windows. devices.
embedded control
systems.
9 / 11
ARM Versions
Architecture ARM Family The letters or words after “ARM” are used to indicate
the features of a processor.
ARMv4T ARM7TDMI ARMxyzTDMIEJFS
ARMv5TE ARM9E x – Family or series
ARMv6 ARM11 y – Memory Management/Protection Unit
z – Cache
ARMv7-M Cortex-M
T – 16 bit Thumb decoder
ARMv7R Cortex-R D – JTAG Debugger
ARMv7-A Cortex-A (32-bit) M – Fast Multiplier
ARMv8-A Cortex-A (64-bit) I – Embedded In-circuit Emulator (ICE) Macrocell
E – Enhanced Instructions for DSP (assumes TDMI)
J – Jazelle (for accelerated JAVA execution)
F – Vector Floating-point Unit
S – Synthesizable Version
10 / 11
Popular ARM architectures
• ARM7TDMI
– 3 pipeline stages (fetch/decode/execute)
– High code density/low power consumption
– One of the most used ARM-version (for low-end systems)
– All ARM cores after ARM7TDMI include TDMI even if they do not
include TDMI in their labels
• ARM9TDMI
– Compatible with ARM7
– 5 stages (fetch/decode/execute/memory/write)
– Separate instruction and data cache
• ARM11
11 / 11
ARM family comparison
12 / 11
Computer Architecture
TEXT
13 / 11
CISC vs RISC
CISC RISC
14 / 11
ARM 7
Architecture
15 / 11
Processor and memory organization
16 / 11
Registers
Only 16 registers are visible to a
specific mode.
A particular set of r0-r12
r13 - (SP,stack pointer)
r14 - (lr, link register)
r15 - (pc, program counter)
Current program status register
(CPSR)
17 / 11
User mode is the usual
ARM program execution
state, and is used for
executing most application
programs.
18 / 11
CPSR
19 / 11
Processor Modes
• The ARM has six operating modes:
– User (unprivileged mode under which most tasks run)
– FIQ (entered when a high priority (fast) interrupt is raised)
– IRQ (entered when a low priority (normal) interrupt is raised)
– Supervisor (entered on reset and when a Software Interrupt instruction is executed)
– Abort (used to handle memory access violations)
– Undef (used to handle undefined instructions)
• ARM Architecture Version 4 adds a seventh mode:
– System (privileged mode using the same registers as user mode)
20 / 11
Register Organization
21 / 11
QUIZ
Answer: 32-bit
22 / 11
QUIZ
23 / 11
QUIZ
24 / 11
QUIZ
25 / 11
QUIZ
Answer: d) 232
26 / 11
QUIZ
27 / 11
ARM Instruction Set
Instruction Set
ARM defines two separate Instruction Sets
• ARM State Instruction Set- 32 bit wide
• Thumb State Instruction Set- 16 bit wide
Features:
All instructions are 32 bits long
Most instructions execute in a single cycle.
Most instructions can be conditionally executed.
A load/store architecture
Data processing instructions act only on registers
Three operand format
Instruction set extension via coprocessors
Very dense 16 bit compressed instruction set (Thumb)
29 / 11
Types of Instructions
• Data Processing Instructions
• Branch Instructions
• Load -Store Instructions
• Software Interrupt Instructions
• Program Status Register Instructions
• Coprocessor Instructions
30 / 11
Instruction Format
Syntax:
<Operation>{<cond>}{S} Rd, Rn, Rm
cond- Indicates Flags to test.
S- Set Condition Flags in CPSR
Rd- Destination
Rn- 'Constant' or 1st Operand
Rm- Operand 2
31 / 11
Data Processing Instructions
• Largest family of ARM instructions, all sharing the same instruction
format.
• Contains:
– Arithmetic operations
– Comparisons (no results - just set condition codes)
– Logical operations
– Data movement between registers
• Remember, this is a load / store architecture
– These instruction only work on registers, NOT memory.
• They each perform a specific operation on one or two operands.
– First operand always a register - Rn
– Second operand sent to the ALU via barrel shifter.
• We will examine the barrel shifter shortly
32 / 11
Arithmetic Operations
• Operations are:
– ADD operand1 + operand2
– ADC operand1 + operand2 + carry
– SUB operand1 - operand2
– SBC operand1 - operand2 + carry -1
– RSB operand2 - operand1
– RSC operand2 - operand1 + carry - 1
• Syntax:
– <Operation>{<cond>}{S} Rd, Rn, Operand2
• Examples
– ADD r0, r1, r2
– ADD R0,R1,#2
– RSB r4, r5,r6
33 / 11
Logical Operation Instructions
• Operations are:
– AND operand1 AND operand2
– EOR operand1 EOR operand2
– ORR operand1 OR operand2
– BIC operand1 AND NOT operand2 [ie bit clear]
• Syntax:
– <Operation>{<cond>}{S} Rd, Rn, Operand2
• Examples:
– AND r0, r1, r2
– BIC r0, r1, r2
34 / 11
Move Instructions
• Operations are:
– MOV operand2
– MVN NOT operand2
Note that these make no use of operand1.
• Syntax:
– <Operation>{<cond>}{S} Rd, Operand2
• Examples:
– MOV r0, r1
– MVN
– MVN ro, r1
35 / 11
QUIZ
36 / 11
QUIZ
37 / 11
QUIZ
38 / 11
QUIZ
Answer: a
Explanation: When switching from one mode to another, instead of
storing the register contents somewhere else it’ll be kept in the
duplicate registers and the new values are stored in the actual
registers.
39 / 11
QUIZ
40 / 11
COMPARE INSTRUCTIONS
• The only effect of the comparisons is to
– UPDATE THE CONDITION FLAGS. Thus no need to set S bit.
• Operations are:
– CMP operand1 - operand2, but result not written
– CMN operand1 + operand2, but result not written
– TST operand1 AND operand2, but result not written
– TEQ operand1 EOR operand2, but result not written
• Syntax:
– <Operation>{<cond>} Rn, Operand2
• Examples:
– CMP r0, r1
– TST
– TEQ 41 / 11
Shift /Rotate Instructions
LSL R1, R2, #3 ; Logical shift left by 3 bits with flag update
LSR R4, R5, #6 ; Logical shift right by 6 bits
LSL R4, R5, #6 ; Logical shift left by 6 bits
ROR R4, R5, R6 ; Rotate right by the value in the bottom byte of R6
RRX R4, R5 ; Rotate right with extend (one bit only).
42 / 11
Load and Store Instructions
LDR R0, NUM ;
load R0 with the value of NUM in
memory
STR R0,[R1];
store R0 in the byte address R1
43 / 11
Condition Codes
44 / 11
Register usage in subroutine calls
• Branch instructions to call and return from subroutines.
• A subroutine is a block of code that performs a task based on some arguments and
optionally returns a result.
• To call subroutines, use a branch and link instruction.
Syntax: BL destination
The BL instruction:
• Places the return address in the link register.
• Sets the PC to the address of the subroutine.
• After the subroutine code has executed you can use a BX LR instruction to return.
45 / 11
ADVANCED ARM FEATURES
• DSP:
Multiply –accumulate instructions (MAC) can perform a 16x16 or
32x16 MAC in one clock cycle.
• SIMD:
A single register is treated as having several smaller data elements
such as bytes.
• NEON:
It is beyond SIMD instructions to provide a new set of registers and
additional features
46 / 11
ADVANCED ARM FEATURES
• Trust Zone:
It is a special monitor mode which allows the processor to enter a
source to perform operations not permitted in normal mode.
• Jazelle:
It allows direct extension of 8-bit Java byte codes, A byte code
interpreter does not need to execute java programs.
• Cortex:
Cortex A5 –Provides Jazelle execution of Java, floating point
processing and NEON multimedia instructions.
Cortex A8 – It is a dual issue in order to superscalar processor.
47 / 11
ADVANCED ARM FEATURES
• Cortex A9 – It can be used in multiprocessor with upto four
processing elements.
• Cortex A15 – MP core is a multicore processor with upto four
CPUs.
• Cortex R – It is designed for real time embedding computing .It
provides SIMD operations for DSP, a hardware divider and a
memory protection unit for operating system.
• Cortex M –It is designed for microcontroller based systems that
require low cost and low energy operation.
48 / 11
ARM BOARD -TUTORIAL
https://youtu.be/-02YSdNc-Aw
49 / 11
R.M.K. ENGINEERING COLLEGE
R.S.M. NAGAR, KAVARAPETTAI.
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
Presented By:
Mr. R Babuji,
Assistant Professor,
Dept. of ECE/RMKEC
50 / 11
What is ARM?
The ARM stands for Advanced RISC Machine and it is a 32-bit Reduced Instructions Set
Computer (RISC) microcontroller.
It was first introduced by the Acron computers’ organization in 1987.
ARM is the world’s leading provider of RISC based microprocessor solutions and other
semiconductor IP’s with more than 85 billion ARM based chips being shipped to date.
ARM doesn’t manufacture processors or other semiconductor devices but rather licenses
the semiconductor cores as Intellectual Property (IP) to other semiconductor companies
like ATMEL, Phillips (now NXP), Samsung etc.
51 / 11
Three architecture profiles: A, R and M.
A-Profile (Applications) R-Profile (Real-Time) M-Profile (Microcontroller)
Targeted at
High
systems with
performance. Small, highly
real-time
Designed to run a power-efficient
requirements.
complex devices..
Commonly found
operating system, Found at the heart
in networking
such as Linux or of many IoT
equipment, and
Windows. devices.
embedded control
systems.
52 / 11
ARM 7
Architecture
53 / 11
Register Organization
54 / 11
QUIZ
55 / 11
QUIZ
56 / 11
QUIZ
58 / 11
QUIZ
5.Which of the following has a Harvard architecture?
a) EDSAC
b) SSEM
c) PIC
d) CSIRAC
Answer: C
Explanation: PIC follows Harvard architecture in which the
external bus architecture consists of separate buses for
instruction and data whereas SSEM, EDSAC, CSIRAC are
stored program architecture.
59 / 11
ARM Instruction Set
Instruction Set
ARM defines two separate Instruction Sets
• ARM State Instruction Set- 32 bit wide
• Thumb State Instruction Set- 16 bit wide
Features:
All instructions are 32 bits long
Most instructions execute in a single cycle.
Most instructions can be conditionally executed.
A load/store architecture
Data processing instructions act only on registers
Three operand format
Instruction set extension via coprocessors
Very dense 16 bit compressed instruction set (Thumb)
61 / 11
Types of Instructions
• Data Processing Instructions
• Branch Instructions
• Load -Store Instructions
• Software Interrupt Instructions
• Program Status Register Instructions
• Coprocessor Instructions
62 / 11
Instruction Format
Syntax:
<Operation>{<cond>}{S} Rd, Rn, Rm
cond- Indicates Flags to test.
S- Set Condition Flags in CPSR
Rd- Destination
Rn- 'Constant' or 1st Operand
Rm- Operand 2
63 / 11
Data Processing Instructions
• Largest family of ARM instructions, all sharing the same instruction
format.
• Contains:
– Arithmetic operations
– Comparisons (no results - just set condition codes)
– Logical operations
– Data movement between registers
• Remember, this is a load / store architecture
– These instruction only work on registers, NOT memory.
• They each perform a specific operation on one or two operands.
– First operand always a register - Rn
– Second operand sent to the ALU via barrel shifter.
• We will examine the barrel shifter shortly
64 / 11
Arithmetic Operations
• Operations are:
– ADD operand1 + operand2
– ADC operand1 + operand2 + carry
– SUB operand1 - operand2
– SBC operand1 - operand2 + carry -1
– RSB operand2 - operand1
– RSC operand2 - operand1 + carry - 1
• Syntax:
– <Operation>{<cond>}{S} Rd, Rn, Operand2
• Examples
– ADD r0, r1, r2
– ADD R0,R1,#2
– RSB r4, r5,r6
65 / 11
Logical Operation Instructions
• Operations are:
– AND operand1 AND operand2
– EOR operand1 EOR operand2
– ORR operand1 OR operand2
– BIC operand1 AND NOT operand2 [ie bit clear]
• Syntax:
– <Operation>{<cond>}{S} Rd, Rn, Operand2
• Examples:
– AND r0, r1, r2
– BIC r0, r1, r2
66 / 11
Move Instructions
• Operations are:
– MOV operand2
– MVN NOT operand2
Note that these make no use of operand1.
• Syntax:
– <Operation>{<cond>}{S} Rd, Operand2
• Examples:
– MOV r0, r1
– MVN
– MVN ro, r1
67 / 11
QUIZ
68 / 11
QUIZ
69 / 11
QUIZ
70 / 11
QUIZ
Answer: a
Explanation: When switching from one mode to another, instead of
storing the register contents somewhere else it’ll be kept in the
duplicate registers and the new values are stored in the actual
registers.
71 / 11
QUIZ
LSL R1, R2, #3 ; Logical shift left by 3 bits with flag update
LSR R4, R5, #6 ; Logical shift right by 6 bits
ROR R4, R5, R6 ; Rotate right by the value in the bottom byte of R6
RRX R4, R5 ; Rotate right with extend (one bit only).
74 / 11
Load and Store Instructions
LDR R0, NUM ;
load R0 with the value of NUM in
memory
STR R0,[R1];
store R0 in the byte address R1
75 / 11
Condition Codes
76 / 11
Register usage in subroutine calls
• Branch instructions to call and return from subroutines.
• A subroutine is a block of code that performs a task based on some arguments and
optionally returns a result.
• To call subroutines, use a branch and link instruction.
Syntax: BL destination
The BL instruction:
• Places the return address in the link register.
• Sets the PC to the address of the subroutine.
• After the subroutine code has executed you can use a BX LR instruction to return.
77 / 11
LPC 214X Family
The LPC2141/2/4/6/8 microcontrollers are based on a 32/16 bit ARM7TDMI CPU with
real-time emulation and embedded trace support, that combines the microcontroller with
embedded high speed flash memory ranging from 32 kB to 512 kB.
Due to their tiny size and low power consumption.
45 fast GPIO lines with up to nine edge or level sensitive external interrupt pins make
these microcontrollers particularly suitable for industrial control and medical systems.
78 / 11
LPC214X- Features
79 / 11
Features
Two 32-bit timers/external event counters and PWM unit (six outputs) and watchdog
timer.
Multiple serial interfaces including two UARTs
Two Fast I2C-bus (400 kbit/s), SPI and SSP with buffering and variable data length
capabilities.
80 / 11
Features
81 / 11
LPC2148 Architecture
Interrupt sources
Every peripheral device consists of a single interrupt line allied to the VIC
(vector interrupt controller).
82 / 11
Pin Connect Block
Peripherals must be coupled with the suitable pins previous to being triggered, and
previous to any connected interrupts being permitted.
The microcontroller functionality can be defined by the pin control module by its pin
selection of registers in a given hardware environment.
There are 3 Pin Function Select Registers in LPC2148:
83 / 11
GPIO- General Purpose Parallel Input/output
LPC2148 has two 32-bit General Purpose I/O ports.
1. PORT0
2. PORT1
Out of these 32 pins, 28 pins can be configured as either general purpose input or output.
3 of these 32 pins (P0.24, P0.26 and P0.27) are reserved. Hence, they are not available
for use. Also, these pins are not mentioned in pin diagram.
84 / 11
PORT1 is also a 32-bit port. Only 16 of these 32 pins (P1.16 – P1.31) are available for use as
general-purpose input or output.
85 / 11
QUIZ
/ 11
QUIZ
87 / 11
QUIZ
88 / 11
QUIZ
4.Princeton architecture is also known as
a) von Neumann architecture
b) Harvard
c) RISC
d) CISC
Answer: a
Explanation: The von Neumann architecture is also
known as von Neumann model or Princeton architecture.
89 / 11
QUIZ
90 / 11
Memory
• On Chip Static RAM (SRAM): This on chip static ram is used for
storing data or code. This ram could be accessed as 8 bit,16 bit or
32 bit. The memory of this ram could be increased to 8 kB,16 kB
or 32 kB by using USB.
91 / 11
Digital to analog Converter:
92 / 11
Analog to Digital Converter:
93 / 11
UART:
UART: This LPC 2148 microcontroller contains two UART whose name are
UART 0 and UART 1.
These UARTs are provided the full mode control handshake interface during
transmitting or receiving the data lines. These are used 16 Byte data rate
during transmitting or receiving the data.
For covering wide range of baud rate they also contain the built in functional
baud rate generator, therefore there is no need of any external crystal of
specific value.
94 / 11
I2C Bus Serial I/O Controller:(Inter-Integrated Circuit)
I2C bus serial is bidirectional multi master bus. It can easily control two or more buses which are
connected to it.
The data which is transferred for master bus to slave bus is transferred through this bidirectional bus at
baud rate up 400 k.
Similarly the serial clock synchronization allows the device to communicate the data of different baud
rate pass through only one serial bus.
This clock synchronization could be used as handshake mechanism for resuming or suspending the data
transfer.
95 / 11
SPI Serial I/O Control (Serial Peripheral Interface)
This SPI serial I/O control supports the duplex
data transfer, means this control supports the
device for transferring the data whose range
4 kB to 16 kB from master bus to slave bus.
This operation is called synchronous serial
communication operation from master but to
slave bus. This data is transmitted or received in
8 frames and each frame is contains 4 bits to 16
bits.
96 / 11
Timers:
97 / 11
Watch Dog Timer:
98 / 11
Real Time Clock (RTC):
In this LPC 2148 microcontroller, the RTC is designed to set the counters for the
measuring the whole time when the controller is in operating mode or idle mode.
It has designed to consume little power which make it suitable for battery powered
systems where CPU is not continually in operating mode.
99 / 11
Crystal Oscillator:
This LPC 2148 microcontroller
contains the on chip integrated
oscillator which operate with an
external crystal whose range is in
between 1 MHz to 25 MHz Its
output frequency is called focs and
controller clock frequency is called
CCLK.
100 / 11
PLL
PLL: This LPC 2148 microcontroller contains two phase locked loops whose names are
PLL0 and PLL1.The input frequency whose range is in between 1 MHz to 25 MHz is
accepted by this PLL. This frequency range could be extended from 10 MHz to 60 MHz
by using the current controlled oscillator (CCO)
101 / 11
ARM BOARD PERIPHERALS -VIDEO
https://youtu.be/wMdLTpyFUYo
102 / 11
LPC2148
Peripherals
LPC2148-Timer Unit
23/07/2020
LPC214x Timer
Timer/Counter0 and Timer/Counter1 are functionally identical except for the peripheral base
address.
A 32-bit Timer/Counter with a programmable 32-bit Prescaler.
- Counter or Timer operation
- Up to four 32-bit capture channels per timer,
Four 32-bit match registers that allow:
– Continuous operation with optional interrupt generation on match.
– Stop timer on match with optional interrupt generation.
– Reset timer on match with optional interrupt generation.
Up to four external outputs corresponding to match registers, with the following
capabilities:
– Set low on match.
– Set high on match.
– Toggle on match.
– Do nothing on match. 104 / 11
Applications
105 / 11
Add title here
106 / 11
TIMER/COUNTER0 and TIMER/COUNTER1 register map
Generic Description
Name
IR Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify
which of eight possible interrupt sources are pending.
TCR Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer
Counter can be disabled or reset through the TCR
TC Timer Counter. The 32-bit TC is incremented every PR+1 cycles of PCLK. The TC is controlled
through the TCR.
PR Prescale Register. The Prescale Counter (below) is equal to this value, the next clock increments
the TC and clears the PC.
PC Prescale Counter. The 32-bit PC is a counter which is incremented to the value stored in PR.
When the value in PR is reached, the TC is incremented and
the PC is cleared. The PC is observable and controllable through the bus interface.
MCR Match Control Register. The MCR is used to control if an interrupt is generated and if the TC is
reset when a Match occurs.
107 / 11
TIMER/COUNTER0 and TIMER/COUNTER1 register map
Generic Description
Name
MR0 - The Match register values are continuously compared to the Timer Counter
MR3 value. When the two values are equal, actions can be triggered automatically.
The action possibilities are to generate an interrupt, reset the Timer Counter, or
stop the timer. Actions are controlled by the settings in the MCR register.
CR0 - Each Capture register is associated with a device pin and may be loaded with
CR3 the Timer Counter value when a specified event occurs on that pin. The settings
in the Capture Control Register register determine whether the capture function
is enabled, and whether a capture event happens on the rising edge of the
associated pin, the falling edge, or on both edges.
CCR Capture Control Register. The CCR controls which edges of the capture inputs
are used to load the Capture Registers and whether or not an interrupt is
generated when a capture takes place.
108 / 11
UART
Basics of UART
The UART Protocol uses only two wires (or pins in a device like microcontroller) to
transmit the data. In that, one is for transmitting the data and the pin is called TX pin
in the device. The other pin is used to receive the data and is called RX pin.
UART is a serial communication, the data is transmitted in a series of packets.
Usually, a packet consists of 4 parts: a start bit, the actual data, a parity bit and stop
bits. The following image shows a typical structure of the data packet in UART.
110 / 11
Basics of UART
Coming to UART in LPC2148, the LPC214x series of MCUs have two UART blocks
called UART0 and UART1. Each UART block is associated with two pins, one for
transmission and the other for receiving.
In UART0 block, the TXD0 (Transmit) and RXD0 (Receive) pins in the device are
P0.0 and P0.1 respectively. In case of UART1, the TXD1 and RXD1 pins are P0.8 and
P0.9 respectively.
111 / 11
UART Basic Packet
112 / 11
Registers associated with UART in LPC2148
Generic Description
Name
113 / 11
Registers associated with UART in LPC2148
Generic Description
Name
114 / 11
U0LCR ( Line Control Register )
115 / 11
UxLSR (Line Status Register)
Bit 0 – RDR: Receive Data Ready-This bit will be set when there is a received data in RBR register. This bit will be
automatically cleared when RBR is empty.
Bit 1 – OE: Overrun Error-The overrun error condition is set when the UART Rx FIFO is full and a new character is
received. In this case, the UARTn RBR FIFO will not be overwritten and the character in the UARTn RSR will be lost.
Bit 2 – PE: Parity Error-This bit is set when the receiver detects a error in the Parity.
Bit 3 – FE: Framing Error-This bit is set when there is error in the STOP bit(LOGIC 0)
Bit 4 – BI: Break Interrupt
Bit 5 – THRE: Transmitter Holding Register Empty-THRE is set immediately upon detection of an empty THR. It is
automatically cleared when the THR is written.
Bit 6 – TEMT: Transmitter Empty-TEMT is set when both UnTHR and UnTSR are empty; TEMT is cleared when any
of them contain valid data.
Bit 7 – RXFE: Error in Rx FIFO-This bit is set when the received data is affected by Framing Error/Parity Error/Break
Error.
116 / 11
Baud Rate Generation in UART
The following rules must be followed for the Baud rate generation.
Minimum value for MULVAL must be 1 i.e. 0 < MULVAL <= 15.
The value for DIVADDVAL can be between 0 and 15 with both the extremes included
i.e.
0 <= DIVADDVAL <= 15.
117 / 11
R.M.K. ENGINEERING COLLEGE
R.S.M. NAGAR, KAVARAPETTAI.
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
Presented By:
Mr. R Babuji,
Assistant Professor,
Dept. of ECE/RMKEC
118 / 11
RECAP OF PREVIOUS SESSIONS
ARM version
ARM Architecture
Features of ARM
Instruction set of ARM processor
PIN diagram of LPC 2148
ARM peripherals –Timer Logic
119 / 11
QUESTIONS:
1. List out the features of ARM processors.
ARM processor features include:
Load/store architecture.
An orthogonal instruction set.
Mostly single-cycle execution.
Enhanced power-saving design.
64 and 32-bit execution states for scalable high performance.
120 / 11
2. Define 2 types of Endians
Both little-endian and big-endian memory addressing. The
ARM processor can be configured at power-up to address the bytes
in a word in either little-endian mode (with the lowest-order byte
residing in the lowest storage address) or Big-endian mode (with
the lowest-order byte residing in the highest storage address).
121 / 11
3. What is subroutine?
Large programs are hard to handle and so broken into smaller
programs called as subroutines.
122 / 11
UART
UART
• UART (Universal Asynchronous Receiver/Transmitter) is a serial communication protocol in which data
is transferred serially bit by bit at a time. Asynchronous serial communication is widely used for byte-
oriented transmission. In Asynchronous serial communication, a byte of data is transferred at a time.
• UART serial communication protocol uses a defined frame structure for their data bytes. Frame
structure in Asynchronous communication consists:
START bit: It is a bit with which indicates that serial communication has started and it is
always low.
Data bits packet: Data bits can be packets of 5 to 9 bits. Normally we use 8- bit data
packet, which is always sent after the START bit.
STOP bit: This usually is one or two bits in length. It is sent after data bits packet to
indicate the end of frame. Stop bit is always logic high.
124 / 11
Basics of UART
Coming to UART in LPC2148, the LPC214x series of MCUs have two UART blocks
called UART0 and UART1. Each UART block is associated with two pins, one for
transmission and the other for receiving.
In UART0 block, the TXD0 (Transmit) and RXD0 (Receive) pins in the device are
P0.0 and P0.1 respectively. In case of UART1, the TXD1 and RXD1 pins are P0.8 and
P0.9 respectively.
125 / 11
FEATURES OF UART0
FEATURES OF UART1
126 / 11
LPC2148 UART PINS
•LPC2148 has 2 pins for UART0 and 8 pins for UART1.
UART0:
UART1:
127 / 11
5. DSR1 (Input pin): Data Set Ready signal pin. Active low signal indicates if
the external modem is ready to establish a communication link with the UART1.
6. DTR1 (Output pin): Data Terminal Ready signal pin. Active low signal
indicates that the UART1 is ready to establish connection with external modem.
7. DCD1 (Input pin): Data Carrier Detect signal pin. Active low signal indicates
if the external modem has established a communication link with the UART1 and
data may be exchanged.
8. RI1 (Input pin): Ring Indicator signal pin. Active low signal indicates that a
telephone ringing signal has been detected by the modem.
128 / 11
Registers associated with UART in LPC2148
Generic Description
Name
129 / 11
Registers associated with UART in LPC2148
Generic Description
Name
130 / 11
U0LCR ( Line Control Register )
131 / 11
UxLSR (Line Status Register)
Bit 0 – RDR: Receive Data Ready-This bit will be set when there is a received data in RBR register. This bit will be
automatically cleared when RBR is empty.
Bit 1 – OE: Overrun Error-The overrun error condition is set when the UART Rx FIFO is full and a new character is
received. In this case, the UARTn RBR FIFO will not be overwritten and the character in the UARTn RSR will be lost.
Bit 2 – PE: Parity Error-This bit is set when the receiver detects a error in the Parity.
Bit 3 – FE: Framing Error-This bit is set when there is error in the STOP bit(LOGIC 0)
Bit 4 – BI: Break Interrupt
Bit 5 – THRE: Transmitter Holding Register Empty-THRE is set immediately upon detection of an empty THR. It is
automatically cleared when the THR is written.
Bit 6 – TEMT: Transmitter Empty-TEMT is set when both UnTHR and UnTSR are empty; TEMT is cleared when any
of them contain valid data.
Bit 7 – RXFE: Error in Rx FIFO-This bit is set when the received data is affected by Framing Error/Parity Error/Break
Error.
132 / 11
QUIZ
Ans: b) Microprocessor
133 / 11
2. A …………. is a way of working, organizing or doing one or many tasks
according to a fixed plan, program or set of rules.
a) Microcontroller
b) System
c) Embedded System
d) Embedded Processor.
134 / 11
3. Which one of the following is board based system?
a) Data bus
b) Address bus
c) VMEbus
d) DMA bus
135 / 11
4. What are the major goals of embedded system design?
a) Performance, cost , and Reliability
b)Requirements, Specification and Design
c) Hardware , Software and System Integration
136 / 11
5. A logic analyzer records data in either of two modes they
are…………...
a)State and running
b)State and timing
c)Standard and timing
d)Standard time mode.
137 / 11
PULSE WIDTH MODULATION
138 / 11
• Through PWM technique, we can control the power delivered to the load by using ON- OFF
signal.
• LPC2148 has PWM peripheral through which we can generate multiple PWM signals on PWM
pins. Also, LPC2148 supports two types of controlled PWM outputs as,
• Single Edge Controlled PWM: All the rising (positive going) edges of the output waveform
are positioned/fixed at the beginning of the PWM period. Only falling (negative going) edge
• Double Edge Controlled PWM: All the rising (positive going) and falling (negative going)
edge positions can be controlled to vary the pulse width of PWM. Both the rising as well as the
139 / 11
PWM Signal with different duty cycle
140 / 11
THE VARIOUS PWM REGISTERS THAT ARE USEFUL IN CONTROLLING AND GENERATING PWM.
If an interrupt is generated, then the corresponding bit in this register becomes HIGH.
Otherwise the bit will be LOW.
141 / 11
2. PWMTCR (PWM Timer Control Register)
It is an 8-bit register.
It is a 32-bit register.
It is incremented when the PWM Prescale Counter (PWMPC) reaches its terminal count.
It is a 32-bit register.
142 / 11
5. PWMPC (PWM Prescale Counter)
It is a 32-bit register.
It controls the division of PCLK by some constant value before it is applied to the PWM
Timer Counter.It is incremented on every PCLK.
When it reaches the value in PWM Prescale Register, the PWM Timer Counter is
incremented and PWM Prescale Counter is reset on next PCLK.
6. PWMMR0-PWMMR6 (PWM Match Registers)
These are 32-bit registers.
The values stored in these registers are continuously compared with the PWM Timer Counter
value.When the two values are equal, the timer can be reset or stop or an interrupt may be
generated.
The PWMMCR controls what action should be taken on a match.
143 / 11
7. PWMMCR (PWM Match Control Register)
It is a 32-bit register.
It controls what action is to be taken on a match between the PWM Match Registers and PWM Timer
Counter.
8. PWMPCR (PWM Control Register)
It is a 16-bit register.
It is used to enable and select each type of PWM.
It is used to control the update of the PWM Match Registers when they are used for PWM generation.
144 / 11
ARM 9 PROCESSOR
145 / 11
FEATURES OF ARM9
146 / 11
Applications of ARM9
147 / 11
ARM 9 Architecture diagram
148 / 11
Thank You..