D
D
Dreker0522022-01-21 18:10:02
Atmel AVR
Dreker052, 2022-01-21 18:10:02

How to sequentially write numbers to Assembler Atmega168 RAM?

It is necessary to write sequentially numbers into RAM, is there some kind of template for doing this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
evgeniy_lm, 2022-01-21
@evgeniy_lm

Recording options +100500. It all depends on where you take these numbers from and in what order you write them down
. In general, it will look something like this:
; write the starting address of the RAM in the register X
ldi r27, hh ; high byte of address
ldi r26, ll ; low byte of address
loop:
......
; somewhere in r16 we took the number
st X+,r16 ; written a number into RAM and an increment of the value of the register X
cpi r27, hh1 ; check the high byte of the address for the limit value
brne loop
cpi r26, ll1 ; check the high byte of the address for the limit value
brne loop
; all numbers are written
Once again, this is a primitive example, yours may be completely different, but the 16-bit registers X, Y, Z will still have to be used, at least one of them, and maybe all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question