Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] *sigh*

2007-01-04 by Thomas Keller

Ah.    A real world example of the mysterious lpm instruction. Now I 
see how that is used.  Thanks, David.


David VanHorn wrote:
>
> On 1/3/07, Thomas Keller <tjkeller1@alltel.net 
> <mailto:tjkeller1%40alltel.net>> wrote:
>
> > Well, I was under the impression that data HAD to be in EEPROM or RAM.
> > How woudl you address it if it is in the code space?
>
> Table: .db $00, $01.....
>
> Read_Table: ; called with offset in TEMP, output in TEMP
> clr R0 ; Trashes R0
> ldi ZL,low(table*2) ;Point at the table
> ldi ZH,high(Table*2)
> add ZL,TEMP ;Add the offset
> adc ZH,R0 ;16 bit add
> lpm ;On smaller AVRs the result is in R0, in larger ones it's
> mov TEMP,R0 ;lpm TEMP
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.