I made a piece of code that measures 3 different values every time, and I want to store them in the SRAM.
I'm able to store the 3 values in the SRAM once but I want to place 5 values of each in the SRAM
I know that what I'm doing is not right but it explains what I want to do. Is there a other way of doing this?
Store: mov temp0,count5 ;counter to save sample 5 times cpi temp0,$05 brne Store0 clr count5 Store0: sbrc Loca,0 ;sample saved to tempmes1 rjmp Store1 sbrc Loca,1 ; rjmp Store2 sbrc Loca,2 ; rjmp Store3 cbr Loca,$07 sbr Loca,$01 ret Store1: cbr Loca,$01 sbr Loca,$02 ldi Zl,low(Tempmes1) ;Set to begining of Sram ldi Zh,high(Tempmes1) std Z+count5,temp2 ;save Sample in Sram with displacement ret Store2: cbr Loca,$02 sbr Loca,$04 ldi Zl,low(Tempmes2) ldi Zh,high(Tempmes2) std Z+count5,temp2 ret Store3: inc count5 cbr Loca,$04 sbr Loca,$01 ldi Zl,low(Tempmes3) ldi Zh,high(Tempmes3) std Z+count5,temp2 ret
This is what I mean:
I know that on the place of count5 there must be a number, but I want this to be the number that is inside the register count5. This number is changing every time.
Can anyone give me a clue if this is possible?