At 11:41 30/04/98 -0500, you wrote: >Can I control where execution resumes after an external interupt on the 16C63? >I want to start at the head of the main loop, but not lose my current >variables. > >Can I, and if so, How? > >Thanks, > >John C. >John A. Craft The main difference between PIC16C84 and PIC16C63 is RAM page, PIC16C63 has 2 RAM pages with no common byte between the two pages. So when an interrupt occurs, STATUS page bit is unknown and you are obliged to store first W register, and after STATUS, so W Register will be store in 0x20 ###or### depending of STATUS page bit in 0xA0. The problem does not appear with 16C84 as RAM in page 1 is remapped in page 0. Here the code for INT: INTW equ 0x20 ; Must be RESERVED ALSO in PAGE 1 !! (0xA0) INTStatus equ 0x21 ; as STATUS bit page is unknown when interrupt ; occurs org 0x0004 movwf INTW ; Save W and Status registers swapf STATUS,W bcf STATUS,5 ; Clear page BIT movwf INTStatus ; Place here the code for your interrupt ; ---------- END OF INTERRUPT ---------------- IntrEnd: swapf INTStatus,W ; Restore W and Status registers movwf STATUS swapf INTW swapf INTW,W retfie Regards, Philippe. +--------------------------------------------------------+ | Virtual Micro Design | | | | UMPS: The universal Microcontroller Simulator, try it!| | | | Phone: ++33 559.438.458 Fax: ++33 559.438.401 | | | | E-Mail: p.techer@idls.izarbel.tm.fr | | URL: http://wwww.sistudio.com/umps | +--------------------------------------------------------+