Module 123
Module 123
Module 123
Embedded Systems
Dr. Rohini. P
Department of ECE,
IIITDM Kancheepuram
Ubiquitous, invisible
Medical
Automotive
Hidden (computer inside)
Dedicated purpose
Communications
Military
Around 5 Billion in today’s world
M series – Microcontroller
Small size
5
Dr. Rohini. P, Department of ECE, IIITDM Kancheepuram. (Email: [email protected])
Embedded System
Microprocessor
Consists of
Registers
ALU
Control unit
System bus – for interfacing
No operating system – ROM must also include low level routines
Probably the most widely used embedded processor architecture and indeed the most widely used
processor architecture of any kind in the world
Design Philosophy:
Small processor for lower power consumption (for embedded system application)
High code density for limited memory and physical size restrictions
Can interface with slow and low cost memory systems
Reduced die size for processor to accommodate more peripherals
Load/ Store Architecture: data processing instructions work on registers only – Load / store
instructions to transfer data from/to memory
Thumb 16 bit instruction set (results in improvement in code density by about 30%)
Conditional execution
ARM9
Compatible with ARM 7
5 stage pipeline (Fetch/decode/execute/memory/write)
Separate instruction and data cache
ARM10
6 stage pipeline (Fetch/issue/decode/execute/memory/write)
ARM 7
ARM 9
Addressing mode
Memory Access
Operand field specifies where to find the data to execute the instruction
Comment field is also optional and is ignored by the assembler, but it allows you to describe the
software making it easier to understand
An unaligned word access - accessing a 32-bit object (4 bytes) but the address is not
evenly divisible by 4
Address of an aligned word access will have its bottom two LSB = 0
Address of an aligned halfword access will have its bottom bit equal to zero
Examples:
AND{S}{cond} {Rd,} Rn, ;Rd=Rn&op2
ORR{S}{cond} {Rd,} Rn, ;Rd=Rn|op2
EOR{S}{cond} {Rd,} Rn, ;Rd=Rn^op2
BIC{S}{cond} {Rd,} Rn, ;Rd=Rn&(~op2)
ORN{S}{cond} {Rd,} Rn, ;Rd=Rn|(~op2)
Examples:
LSR{S}{cond} Rd, Rm, Rs ; logical shift right Rd=Rm>>Rs (unsigned)
LSR{S}{cond} Rd, Rm, #n ; logical shift right Rd=Rm>>n (unsigned)
ASR{S}{cond} Rd, Rm, Rs ; arithmetic shift right Rd=Rm>>Rs (signed)
ASR{S}{cond} Rd, Rm, #n ; arithmetic shift right Rd=Rm>>n (signed)
LSL{S}{cond} Rd, Rm, Rs ; shift left Rd=Rm< <Rs
LSL{S}{cond} Rd, Rm, #n ; shift left Rd=Rm<<n
Example:
Input LDR R5,=0x400043FC ;R5=0x400043FC, R5 points to PortA
LDR R6,[R5] ;Input from PortA into R
Dr. Rohini. P, Department of ECE, IIITDM Kancheepuram. (Email: [email protected])
I/O ports
Processor
n n
DQ Input/Output Port
Switches are negative logic and will require activation of the internal pull-up resistors.
To use the LED, make the PF3 – PF1 pins an output
To activate the red color, output a one to PF1, blue color is on PF2, green color is
controlled by PF3
Pull-down resistor - the digital signal will be low if the switch is not pressed and high if
the switch is pressed - positive logic because the asserted state is a logic high.
Pull-up resistor - the digital signal will be high if the switch is not pressed and low if the
switch is pressed - negative logic because the asserted state is a logic low.
Individual port pins can be general purpose I/O (GPIO) or have an alternate function.
Set bits in the alternate function register (e.g., GPIO_PORTF_AFSEL_R) to activate the alternate functions
For each I/O pin whether GPIO or alternate function - the digital circuits must be enabled by setting the bit in the
enable register (e.g., GPIO_PORTF_DEN_R)
To enable analog input – enable analog mode select register (e.g., GPIO_PORTF_AMSEL_R)
Data register (e.g., GPIO_PORTF_DATA_R) - to perform input/output on the port - read and write the data
register multiple times
1. Turn on clock in SYSCTL_RCGCGPIO_R, Wait two bus cycles – check using PRGPIO register
Design to write friendly software - only affects the individual pins as needed.
Friendly software does not change the other bits in a shared register.
The difficulty of unfriendly code is each module will run properly when tested by itself,
but weird bugs result when two or more modules are combined.