Combinepdf
Combinepdf
Handbook
8051 Microcontroller
8051- pin diagram
P a g e 1 | 12
Microcontrollers MIT Manipal
P a g e 2 | 12
Microcontrollers MIT Manipal
P a g e 3 | 12
Microcontrollers MIT Manipal
P a g e 4 | 12
Microcontrollers MIT Manipal
P a g e 5 | 12
Microcontrollers MIT Manipal
P a g e 6 | 12
Microcontrollers MIT Manipal
P a g e 7 | 12
Microcontrollers MIT Manipal
ARM7 Microcontroller
ARM 7 Operating mode
P a g e 8 | 12
Microcontrollers MIT Manipal
P a g e 9 | 12
Arithmetie Insirwetions
ADD Basic addition Fg: ADD RO, R1, R2, RORI +R2
ADC Add with Carry Fg: ADC R0, R1, R2; RO R I + R2 + Carry
SUB Basic subtraction Fg: SUB Ro, R1, R2; RO RI - R2
SBC Subtract with borrow (carry) Eg: SBC RO, R1, R2; RO R I R2 ICarry
RSC Reverse subtraction with carryY Eg: RSC RO, R1, R2; Ro R2 RI - ICarry
Note: Nomaly Arithmenic instructions do net alfect flags. Ywe want flags to be affected we must write S as a post
Eg: ADDS RO, RI, R2
Note: In ARM, subraction
produces an inverted carry
hat mesif there wws a borrow, Cary flag beromes 0 and ý No borrew then cary flag becomes I.
Logic Instructions
BIC AND with complement Eg:BIC RO, R1,R2; RO ERI AND (NOT) R2
Sameas instruction 109 of8051 instruction set
Eg: CMP RO, R1;
Performs RO R1, Does not store the result but
S CMP Ordinary Compare
affects the flags.
Compare with Negated value
Eg: CMN RO, R1;
Performs RO + R1, Does not store the result but
CMN
affects the flaqs.
Eg: TST RO, R1;
Performs RO AND RI, Does not store the result but
TST Logical AND, Only affects flags affects the flags. Same instruction was in there in
8086 also0.
Eg: TEQ RO, R1;
Logical xOR, Only affects flags Performs RO XOR R1, Does not store the result but
8 TEQ
affects theflaqs.
Note: AND, ORR,EOR and BICinstructions donot alfectflag
we wanu flags to be affected we must write S as a postfix.
Eg: ANDS RO, RI, R2
Note: CMP, CMN, TST and TEQ instructions will not store the resul.
115
Mulipty Instructions (Produce 32
bit result of32 bit multiplication)
Eg: MUL RO, R1, R2;
ROR1 x R2
MUL Ordinary Multiplication
MLA RO, R1, R2, R3;
ROR1
x R2 + R3
Multiple Byte Load- Store; Any Subset ofcurrentbank of registers can be transferred to
memory or Fetched from memory. The base register Rn detemines the source or destination
address.
Addresing
mode
Description Start address End address Rn!
A Rn+4*N
increment after Rn Rn+4N -
4
18 increment before Rn+4 Rn +4 N Rn+4N
DA Rn 4 N
decrement after Rn 4N+4 Rn
DB decrement before Rn 4 * N Rn-44 Rn 4*N
valid item.
Full ascending (FA): Stack grows up. SP points to the highest address containing a
Stack grows up. SP points to the first empty location above stack
Empty ascending (EA):
data
Stack grows down. SP points to the first location below the stack.
Empty descending (ED):
Instructions Explanation
LDMFD SP, (list ofregisters) Pop the stack and assign values to registers
inascending order. Update sp.
STMFD SP! (list ofregisters Push the registers on the stack in descending8
order. Update sp.
Branch Instructions
117
Semant1cs Example|
Explanation function at .foo
bl label bl.foo (1) Jump unconditionally to the
(2)Save the next PC (PC +4) in the Ir register
Swap Instructions
118