so confused about the st.w instruction (avr assembly)

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Syntax:

st.w Rp[disp], Rs

Operation:

*(Rp + SE(disp16)) ← Rs;

whai is the initial value in Rp for doing or operation with SE(disp16)

what is the resultant address represents?

Please explain what this instruction will do?

Thanks in advance

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The + represents addition, not an OR operation. The instruction simply adds the value in Rp to the sign extended constant disp16 and uses the result as the address to store the contents of Rs into.

Letting the smoke out since 1978

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Thanks for ur reply

what is the initial value in Rp for doing this + operation?

The resultant address depends on this initial value of Rp(to store the contents of Rs)

what is the initial(default) value in a register,before it is used?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no default value for registers (except for the case of reset) -- they have whatever value as is put in them earlier in the code.