8051 Rotate Instructions

ROTATE INSTRUCTIONS

These instruction rotate the accumulator left, or right with or without carry. The instructions are RR, RRC, RL, RLC.

RL Instruction

The RL instruction rotates accumulator left one bit left

Figure shows how the bits rotate left internally and then bit-7 to bit-0

No flags are affected by this instruction

Figure 7.1 : Rotate left logic operation

format Example/

Operation

Opcode/ Encoding Next Opcode Byte Flags affected Byte Cycles
RL A RL A

An+1=An
for n=0 to 7
A0=A7

00100011 none 1 1

 

RLC Instruction

 

Rotate the accumulator left one bit through carry

carry-bit into bit-0, and Bit-7 into carry

carry flag is update with bit-7

No other flags are affected by this operation.

 

format example  /

Operation

Opcode/ Encoding Subsequent Byte of Opcode Flags affected Cycles
RLC A RLC A

An+1=An
for n=0 to 7
A0=C
C=A7

00110011 C, P 1

 

RR Instruction

RR Instruction rotate the accumulator Right one bit

Bit-7 to bit-6…..bit-1 to bit-0; bit -0 into bit-7

No flags are affected by this instruction.

Format example /Operation Opcode/ Encoding Next byte of opcode Flags affected Cycles
RR A RR A

An = An+1
for n=0 to 7
A7 = A0

00000011 none 1

 

RRC Instruction

RRC is used to rotate accumulator through carry

Carry ->Bit-7, bit-7 to bit-6 and so on, and finally bit-0 in to carry.

No other flags are affected by this instruction.

Format Example/ Operation Opcode/ Encoding Next Opcode Byte Flags affected Cycles
RRC A RRC A

An = An+1

for n=0 to 7

A7 = C

C=A0

00010011 C,P 1

 

NOP

  • NOP instruction does nothing.
  • No registers or flags are affected on execution
  • It is typically used to generate a delay in execution or to reserve space in code memory
Format Example

Operation

Opcode/ Encoding Flags affected Byte Cycles
NOP NOP

PC=PC+1

00000000 none 1 11

 

Updated: August 3, 2019 — 6:09 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

care4you © 2014 care4you © Revision-1: 2016 care4you © Revision-2: 2019 Connect On Facebook DMCA.com Protection Status
error: Content is protected !!