On Tue, Jun 10, 1997 at 11:39:54AM +0000, Aydin Yesildirek wrote: > The problem is: PCLATH doesn't show the wright value after RETFIE. The RETFIE instruction (or any other return instruction) does NOT update PCLATH. The stack is 14 bits wide, and stores the whole PC, of which only 8 bits is visible in PCL. The PCLATH register is NOT the upper 8 bits of the PC, but just a holding register that is copied to the high bits of the PC whenever you explicitly change PCL (by a goto, movf etc.). What you have to do is save PCLATH on entry to your ISR, and restore it on exit. This is necessary if you have any goto's in the ISR, and your PIC has more than one ROM page. You also need to zero PCLATH in the ISR, after saving it, of course, but I suspect you are already doing that. -- Clyde Smith-Stubbs |HI-TECH Software, |Voice: +61 7 3354 2411 clyde@htsoft.com |P.O. Box 103, Alderley,|Fax: +61 7 3354 2422 http://www.htsoft.com|QLD, 4051, AUSTRALIA. |PGP: finger clyde@htsoft.com --------------------------------------------------------------------------- Download a FREE beta version of our new ANSI C compiler for the PIC microcontroller! Point your WWW browser at http://www.htsoft.com/