Am I correct in assuming that if you write code that is greater that 1 page, then you must duplicate the ISR in both pages anyway - regardless of whether my ISR changes PCLATH. Presumably, if an interrupt occurs whilst executing code in page 1, the jump vector at 0004h will jump to that location in the CURRENT page - not page 0. Therefore ISR _MUST_ exist in both pages(?) I don't remember this being made clear in the data book regarding interrupts.... It seems obvious, or am I missing something??? ( I can't offhand remember how many address bits are in a 'goto' instruction! ) I'm basing these musings on a 16C74 - but it should apply for any processor. Neil ---------- From: Mike Keitz Sent: 17 March 1998 16:25 To: PICLIST@MITVMA.MIT.EDU Subject: Re: Problems with code in page 1 On Tue, 17 Mar 1998 01:50:17 -0800 Andrew Warren writes: >Darryl Masters wrote: > >> I am having a problem with running code in page 1 of a PIC16C73A. >> .... > The problem's undoubtedly in your interrupt handler's > save/restore code. If you post a copy of the actual "intsr" > routine, I'm sure that someone here will solve your problem > immediately. > If you can write your ISR without using CALL or GOTO statements (and of course no modify PCL's either), then there's no need to do anything about PCLATH at all during the ISR. Otherwise you'd have to save it and set it to 0 before the first GOTO or CALL in the ISR. Another technique is to write the ISR routines as a macro and place it at the same place in all (both) code pages. Then regardless of the value of PCLATH, one or the other identical copies of code will execute. In the main program, you don't need to save PCLATH in RAM, just use bcf/bsf instructions on bit 3 depending on whether the program is going to page 0 or 1. This works on chips with 4K (2 pages) of code space. Larger chips would need to set up higher bits of PCLATH as well. _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]