Saturday, April 30, 2016

8051 Program – bit shifting

; shift right
ORG 0H
MOV A, #0C5H; A = 11000101B
RR A; A = 11100010B
END

; shift right with carry
ORG 0H
MOV A, #0C5H; A = 11000101B
RRC A; A = 01100010B, C = 1
END

; shift left
ORG 0H
MOV A, #0C5H; A = 11000101B
RL A; A = 10001011B
END

; shift left with carry
ORG 0H
MOV A, #0C5H; A = 11000101B
RLC A; A = 10001010B, C = 1
END



Related topics:
8051 Program - 8bit random number generator   |   8051 Program - 16bit random number generator   |   8051 Program - count external interrupt   |   8051 Program - frequency measurement   |   8051 Program - led rotation pattern   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment