-www.iamtechnical.com-

SECTION I-2: The MOVLW Instruction in the PIC micro-controller

The MOVLW instruction moves 8 bit data into the WREG register. It has following format.

MOVLW k ;move literal value K into WREG

 

K is an 8 bit value that can range from 0-255 in decimal, or 00-FF in hex. The 'L' stands for literal, a number must be used. In other words, if we see the word literal in any instruction, we are dealing with an actual value that must be provided right there with the instruction. This is similar to the immediate value we see in other microprocessors. In MOVLW, the letter L (literal) comes first and then the letter W (WREG), which means "move a literal value to WREG" the destination.

The folowing instruction loads the WREG register with a literal value of 25H i.e, 25 in hex.

MOVLW 25H ;move value 25H unto WREG (WREG = 25H)

 

The following instruction loads the WREG register with value 87H (87 in hex)

MOVLW 87H ;load 87H into WREG (WREG = 87H

 

The following instruction loads the WREG register with value 15H (15 in hex and 21 in decimal)

MOVLW 15H ;load 15H into WREG (WREG = 15H)

 

More From Iamtechnical.com

Facebook Like For Iamtechnical.com !