--- In AVR-Chat@yahoogroups.com, "steamphreaque" <tjkeller@...> wrote: >I have a problem: You have two problems. Firstly, the Z "register" is actually two 8- bit registers and you have to load them separately. Secondly, to read indirectly through the Z register, you need to use either ld or ldd. (The lds instruction is for loading from an absolute address.) ldi r30, lo8(LABEL) ldi r31, hi8(LABEL) ld r22, Z+ I have used a macro to simplify loading the Z register: // macro to load a data address into r31:30 .macro ldiZ _data ldi r30, lo8(\_data) ldi r31, hi8(\_data) .endm Then, you can use it thusly: ldiZ LABEL ld r22, Z+ Don Kinzer ZBasic Microcontrollers http://www.zbasic.net
Message
Re: problems
2008-03-23 by Don Kinzer
Attachments
- No local attachments were found for this message.