MOV 32-bit number in AVR assembler

Hi all. I have a simple number that I have been playing with in assembler. I manipulate it in assembler and return the value to Arduino. This just to learn and be comfortable with 32 bit numbers. 0x00010105. It seems the MOVW R24 , R18 gives me back the value of 517 (as expected). The MOVW R26, R18 seems to have no affect and I never see the 65280 part.

My question is is there something similar to MOVW but for double the size: for 32 bit numbers not just for 16 bit numbers?

Thank you

Nope, this is a 8-bit architecture. Moving 16-bit number was likely build in for peripheral access e.g. 10-bit ADC results, 16-bit timers and some pointer stuff. For moving 32-bit numbers you can use 32-bit microcontrollers.

Have a look at the AVR Instruction Set Manual

Yuppers, The ESP32. There are 2 processors on the ESP32. One processor is a dual core... The other processor is called ULP, for ultra low power. The ULP can be programmed from the Arduino IDE and is programmed using macro assembler.

No. You have to use multiple smaller moves.

If you have a 32bit number in R18..R21, and you want to move it to R24..R27, you'd use

  movw r24, r18
  movw r26, r20

things are worse if you're loading registers from memory, since there is no "ldw" instruction.

BTW: not all AVRs have the "movw" instruction. (although at this point, I don't think you're likely to run into one that doesn't have it.)

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.