Yeah, I always forget about IRP since I usually use the 873. Regards, Al Williams AWC * Floating point A/D http://www.al-williams.com/awce/pak9.htm > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of David Duffy > Sent: Tuesday, August 28, 2001 5:37 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: reverse indirect addressing > > > Ha! You're dead right. You can still do it if you manipulate the FSR's MSB > and the IRP bit if required. It depends on which RAM banks you > want to use. > Just do the fiddling where I but the bank1 & bank0 codes. I've previously > done what Al said & used 2 pointers before. (located in the high 16 bytes) > > At 10:34 PM 27/08/2001 -0500, you wrote: > >Hmmm... I'm a little bleary eyed, but I don't think INDR works that way. > >INDR is one of those magic registers that is in every bank. So it doesn't > >matter what RP0,RP1 is set to, INDR is always [FSR]. > > > >To do what you want, you need to keep the FSR "pointers" in a > shared address > >(depends on what processor you are using, but they all have some > bytes that > >are in all maps). Then you would swap FSR in and out as needed. > Sure, its a > >bottleneck just like the W register, but that's how it works. > > > >Regards, > > > >Al Williams > >AWC > >* APP-II simplifies PIC development: > >http://www.al-williams.com/awce/app1.htm > > > > > > > -----Original Message----- > > > From: pic microcontroller discussion list > > > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of David Duffy > > > Sent: Monday, August 27, 2001 8:35 PM > > > To: PICLIST@MITVMA.MIT.EDU > > > Subject: Re: [PIC]: reverse indirect addressing > > > > > > > > > At 01:44 AM 28/08/2001 +0100, you wrote: > > > >Sorry, probably didn't make myself clear.... > > > >Specifically what I was trying to do was specify a register > to be read > > > >rather than reading from the INDR > > > > > > > >For example, if I have a block of registers set aside for some > > > data, I can > > > >clear sequential registers by: > > > > > > > >movlw MYFIRSTREG > > > >movwf FSR > > > >LOOP > > > >movlw 0 > > > >movwf INDR > > > >incf FSR,1 > > > >goto LOOP > > > > > > > >So this clears an infinite number of registers. In practice a > > > quick decfsz > > > >would limit it. In practice however, we often want to READ from > > > one and copy > > > >it into the next. > > > >Clearly this could be done using > > > > > > > >movf READFROM1,F > > > >movwf MOVETO1 > > > >movf READFROM2,F > > > >movwf MOVETO2 > > > >......... > > > > > > > >etc, etc > > > >But surely it would be better if an indirect addressing > system or some > > > >work-around meant you could avoid explicitly stating such > commands. I ask > > > >because I need to copy 96 registers from one page to another > and I don't > > > >want to end up writing 96*2 lines of code....... > > > > > > You can still use the FSR. Just keep 2 variables as pointers. > > > Do the 2 banks of registers line up? (but on different banks) > > > If so, you can do it in a loop, reading, changing bank, writing > > > and changing bank back again each time. I haven't tested it > > > but the below code should give you the idea. :-) > > > > > > start: > > > movlw .96 > > > movwf count > > > movlw start_address > > > movwf fsr > > > loop: > > > movf indf,w > > > bank1 > > > movwf indf > > > bank0 > > > decfsz count,f > > > goto loop > > > all_done: > > > > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body