Searching \ for 'Need help on returning from external INT' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=need+help+returning
Search entire site for: 'Need help on returning from external INT'.

Truncated match.
PICList Thread
'Need help on returning from external INT'
1998\04\30@124343 by John A. Craft

flavicon
face
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
               (228)689-8103 Voice
Sr. Systems Analyst / Vice President                            (228)689-8130 Fa
x
Nation Computer Services, Inc.                                          w
ww.ncs-ssc.com

MSAAP Bldg 9110
               spam_OUTcraftTakeThisOuTspamncs-ssc.com
Stennis Space Center, MSÊ 39529

1998\04\30@132509 by Philippe

flavicon
face
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.techerKILLspamspam@spam@idls.izarbel.tm.fr                    |
 | URL:    whttp://www.sistudio.com/umps                  |
 +--------------------------------------------------------+

1998\04\30@145545 by Mike Keitz

picon face
On Thu, 30 Apr 1998 11:41:38 -0500 "John A. Craft" <craftspamKILLspamNCS-SSC.COM>
writes:
>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?

Rather than "retfie", just goto the start of the main loop (be sure the
PCLATH bits are set properly).  You don't have to save W and STATUS
because you're not coming back.  This will also disrupt the stack, so the
routine you go to has to be "top level".  The GIE bit will still be
cleared and the INTF bit set though, so you need to reset the interrupt
logic for the next interrupt.

Rather than goto, you could just org the top of the main loop to 4, where
interrupts go.  Any interrupt would restart the main loop, which may not
be what you want.

Data in RAM "general purpose file registers" (I assume this is where the
"current variables" are) is never disturbed automatically except by
turning the power off, which naturally causes it to lose its data.
Resets, SLEEP, WDT timeouts, interrupts, etc. don't affect it unless the
software associated with such events writes to it.

_____________________________________________________________________
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]

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...