----- Original Message ----- From: "Alex De Lara" <alex_de_lara@yahoo.com> To: <AVR-Chat@yahoogroups.com> Sent: Wednesday, June 15, 2005 8:20 PM Subject: [AVR-Chat] Re: This assembly oughta be something silly... > --- In AVR-Chat@yahoogroups.com, Dave VanHorn <dvanhorn@d...> wrote: >> > ldi ZH,high(Test_str) ; Load Z register high >> > ldi ZL,low(Test_str) ; Load Z register low >> >> As a couple of others have pointed out, you need to mult >> the string address by two. This is because Z is a BYTE pointer, >> pointing to data that is stored as WORDS. > > Ok, I see that. > >> Also, be aware, the data is stored as words by the >> asembler/compiler, so if you store >> "ABC" you'll end up with $41,$42,$43,$00 > > That's exactly what I expect if I store strings. (yeah, that > 0x00 at the end is fine.) > > So, I am looking at the code right now. > Just opened the "Memory" window so I could browse all > "spaces" (data, program, eeprom, registers, etc) > My string is actually in the code space, which is fine since > right now I just need it to be in someplace. > > What I see is that the instruction > ld r16,Z+ > is not retrieving the byte stored there. > > The address of the begining of the string is physically > 0x0016 but when the instruction is executed, some other > value comes back to the register (0xFF or 0x00 whenever > I use .dseg or leave it out) > > So the question becomes: is there anything else to be set > so I can tell the Z register to grab the byte located > in the [code segment]:0x0020 ? > > It seems it is not reading from the code segment, i.e. the > place where the string is right now. Try lpm. It puts the byte addressed by the Z register in R0. Leon --- [This E-mail has been scanned for viruses but it is your responsibility to maintain up to date anti virus software on the device that you are currently using to read this email. ]
Message
Re: [AVR-Chat] Re: This assembly oughta be something silly...
2005-06-15 by Leon Heller
Attachments
- No local attachments were found for this message.