working with internal SRAM

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

Hello, avr-freaks!

Thanks so much for the feedback with my first question!

I now have a simple question I guess that could be solved in no time:

1) I'm using SRAM (addresses $20 to $28) to store some data (9 bytes);
2) I'm storing these bytes using STS (sts $20,r2...);
3) I'm trying to retrive value from address $20;

BUT

* I can't retrieve that value at the $20 address, for I'm trying to use a variable (r24 to store the address in the SRAM from which to retrieve data in current cycle).

* I'm using lds with immediate address value - this works ok, but how to use variable?

Regards,
Dmitry.

admin's test signature
 

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

The internal RAM starts at address $60.

Location $20 is actually an I/O address which is probably why you are having problems.

Do you have a .org directive in your data segment? (For example:

.dseg
.org $20
.byte variable1
.byte variable2

etc.)

If so, you can probably remove it:

.dseg
.byte variable1
.byte variable2

Sean.

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

Hmmm, so with which address should I start?

What's the best addresses range to use?

admin's test signature
 

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

Accoding to the manual, data memory addresses are
$0-$1F 32 general purpose registers
$20-$5F 64 I/O registers
$60- Internal SRAM

Laurence Boyd II

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

Thanks a lot!

well, i figured out that i should use SRAM starting from $60 bu this explains all the rest.

Regards,
Dmitry.

admin's test signature