----- Original Message ----- From: Andrew E. Kalman To: Sent: Sunday, November 12, 2000 4:56 PM Subject: Re: [PIC]: 18C452 modify PC not working properly ... ? > Bob wrote: > > >I don't think this will work. If movff won't work directly to PCL, I doubt > >it will work indirectly. > > Yes, I'm afraid of that, too > > > > >You might try something like this: > > > > push > > movwf PCLATH > > movf TBLPTRL,W > > movwf TOSL > > movf TBLPTRH,W > > movwf TOSH > > movf PCLATH,W > > return > > > Yep, I've tried that, but the bad thing about it is that one must > control interrupts around it. e.g. > > > bcf 0FF2h,7 ; disable INTs > push ; required, as we'll undo it with a return > clrf TOSU ; TOS = jump-to address > movff TBLPTRH,TOSH ; "" > movff TBLPTRL,TOSL ; "" > bsf 0FF2h,7 ; re-enable INTs > return > > And that still won't work if it's called from within an ISR > (unintended re-enabling of interrupts). It does work OK otherwise, at > least in the SIM. > > Is it the case that the only instruction that can reliably change PCL > on the 18 is addwf? Certainly not! I've used movwf extensively without trouble, and I'm sure any 'normal' instruction will give the correct results. It is just that the MOVFF is a funny case. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) > > ______________________________________ > Andrew E. Kalman, Ph.D. aek@pumpkininc.com > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu