kanishka13
Junior Member level 1
m32def.inc
I had written a basic program to STORE data in SRAM and compiled it with the data memory window open. The result was as expected. The data from a register was STORED into the SRAM location. The program was as below....
;Program to store data into SRAM location 0x60
.include "m32def.inc"
.org 0x000
rjmp STORE
STORE:
ldi r16,10
sts 0x60,r16 ;store direct into SRAM
rjmp STORE
But then...
I had written another program to load the contents at 0x60 location of SRAM to R16. I had recompiled the new program. Logic says that since i've rebuild the whole program again the previous contents of the SRAM must be lost and the value loaded into the R16 register must be FF.
Program to load data from SRAM and store it in R16
.include "m32def.inc"
.org 0x000
rjmp LOAD
LOAD:
lds r16,0x60 ;load direct from SRAM
rjmp LOAD
But the value that had been stored by the previous program was loaded....So isint this a BUG?? :?::!:
Or am I wrong somewhere??....:?::?:
I had used AVRSTUDIO 4.0 with SP1 for atmega32.
I had written a basic program to STORE data in SRAM and compiled it with the data memory window open. The result was as expected. The data from a register was STORED into the SRAM location. The program was as below....
;Program to store data into SRAM location 0x60
.include "m32def.inc"
.org 0x000
rjmp STORE
STORE:
ldi r16,10
sts 0x60,r16 ;store direct into SRAM
rjmp STORE
But then...
I had written another program to load the contents at 0x60 location of SRAM to R16. I had recompiled the new program. Logic says that since i've rebuild the whole program again the previous contents of the SRAM must be lost and the value loaded into the R16 register must be FF.
Program to load data from SRAM and store it in R16
.include "m32def.inc"
.org 0x000
rjmp LOAD
LOAD:
lds r16,0x60 ;load direct from SRAM
rjmp LOAD
But the value that had been stored by the previous program was loaded....So isint this a BUG?? :?::!:
Or am I wrong somewhere??....:?::?:
I had used AVRSTUDIO 4.0 with SP1 for atmega32.