As mentioned before the PIC12F508 has separate memory spaces for program code and data variables. While we can access any data memory location using the movf and movwf instructions described in the previous lesson, it is not possible to use these same instructions to read a value out of program memory.
The only real scenario where we might want to do this is when we need to use a constant value in our code (my_var = 42 in the C language). To deal with these situations, the chip includes a set of special instructions for introducing constant values into the data memory space:
// Write the constant value 42 into my_var movlw 42 movwf my_var
The special movlw instruction copies a constant value (called a literal in microcontroller speak) encoded in the op-code of the instruction into the Working Register. From there we can then copy it into data memory and use it in our program.