8051 - moving value from one register to another

Just a quick question regarding 8051 assembly programming:

I need to transfer a value from register R5 to R0, so I can use R5 for something else. I tried MOV R0, R5 but it fails. I know this is begginer's question, but I guess it wouldn't take to much time for someone experienced to answer this.

Thanks Josip

Reply to
Josip
Loading thread data ...

Solved it myself. I transfered the value over accomulator. MOV A, R5 MOV R0, A I was afraid I would have to use RAM to make the transfer, but this solution suits me fine. Enough talking to myself... Bye

Reply to
Josip

Josip schrieb:

If you want to preserve the content of the accumulator, you might as well use "MOV R0,5" - the 5 will be used as memory address 5, which in fact is R5 in register bank 0. This method is fine as long as you know which register bank you are using. Some assemblers already have predefined constants for these memory addresses (like "AR5" in mine, standing for "absolutely addressed R5").

Tilmann

Reply to
Tilmann Reh

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.