The MOV instruction tells the CPU to move (in actual fact COPY) the source operand to the destination operand.
MOV destination, source ; copy source to destination
Programming in assembly language requires that at least you understand the architecture of the microprocessor or microcontroller you are working with; this means that we need to be well-versed with things like registers in that specific microprocessor or microcontroller. For the Intel 8051 also referred to as MCS-51, the mostly widely used registers include: A (Accumulator), B, R0, R1, R2, R3, R4, R5, R6, R7, Program Counter, and so forth.
The following examples illustrate the MOV instruction showing how the operands are moved into different registers.
MOV A, #40H ; load value 40H into register A, #indicates it is a number
MOV R0, A ; copy contents of A into register R0, thus (A=R0=40H)
MOV R1, A ; copy contents of A into register R1 (A=R1=40H)
MOV R2, #60H ; load value 60H into R3 hence (R3=60H)
MOV A, R2 ; copy contents of R2 into A, as a result (A=R2=60H)
Key points to note:
MOV A, #7D0H ; Not allowed, as 7DO in binary is greater 8 bits
MOV R4, #0F6H ;Add 0 to indicate that the value F is a Hex & not a letter
MOV A, #7 ; the result will be A = 07 i.e. A = 00000111
Related articles:
The world of electronics is constantly evolving, allowing designers and manufacturers to push the boundaries…
PIC microcontrollers are fabricated by Microchip Technology. PIC16C84 and PIC16F84 are the two microcontrollers in…
The ADD instruction tells the microcontroller’s CPU to add the source byte to register A…
8-bit microprocessors are limited in their speed (the number of instructions that can be executed…
The 68HC11 (also abbreviated as 6811 or HC11) is an 8-bit microcontroller that was introduced…
Mutual exclusion typically imposes some conditions on access to a given resource by two or…
View Comments