On Sun, 27 Oct 1996, Chaipi Wijnbergen wrote: > On Sat, 26 Oct 1996, NEIL GANDLER wrote: > > > I am having a problem with a 16c74 program. The program > > length has now exceeded 2K in program length, so now I must > > manipulate the PCLATH register when performing long calls. > > The problem occurs after I place a long call and then try to > > return back to page0 using the RETURN command. > > Neil, > > When you are running on page 0 and calling a routine on page 1, you set > PCLATH to point to page 1, after returning from page 1, PCLATH is still > pointing into page 1, but, you are running in Page 0, so, for each next > call or goto command, the PIC will try to jump to a location in Page 1. > > So, when you use PCLATH, you need to update it before any call that either > jump to another page or jump to a location within the same page but after > returning from the other page. > > chaipi > Thanks for the advice, Do I need to store and restore PCLATH before and after interrupts? Neil