Lecture 5 2
Lecture 5 2
Embedded System
Semester : 5th
Course Code : ES314
TP Sr No: 16, CLO:2, PLO 2, C4
Fair Use Notice
◉ ROR Rd
◉ROL Rd
Serializing data
Shift Instructions
◉LSL Rd ( Logical shift Left)
CLC
LDI R20,0X26; 38
LSL R20; 76 C=0
LSL R20; 152 C=0
LSL R20; 48 C=1
Can LSL be used as multiplication by 2
instruction? If yes then under what condition
Shift Instructions
◉ LSR Rd ( Logical shift Right)
LDI R20,0X26; 38
LSR R20; 19 C=0
LSR R20;9 C=1
LSR R20; 4 C=1
Can LSR be used as division by 2 instruction for
unsigned numbers? If yes then what carry flag will
hold?
Shift Instructions
◉ ASR Rd ( Arithmetic shift Right)
◉ Divide sign numbers by 2
◉ Bits are shifted from left to right
◉ MSB is held constant but copied to D6
SWAP instruction