Searching \ for 'after I return from an interupt...' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=after+return+interupt
Search entire site for: 'after I return from an interupt...'.

Truncated match.
PICList Thread
'after I return from an interupt...'
1998\06\24@151229 by Jonathan M. Newport

flavicon
face
sorry, I'm kind of new to this, but say I've got something in a continuous
loop like:

circle  goto    circle

waiting for an interupt.  when the isr is finished and I use the retfie
command, will it increment the program counter to execute the instruction
after this one? or if it doesn't is there a way that I can increment the
program counter myself? thanks

Jonathan Newport

1998\06\24@153242 by curt

flavicon
face
JN:
I am not sure exactly what you are trying to do ... but an interrupt
does not affect your 'circle' code. If you want to exit circle after the
interrupt try this

#DEFINE iflag   var1,0  ;define bit 0 of GP variable as a flag

       bcf     iflag
circle  btfss   iflag
       goto    circle
nocircle
       .
       .
       .

then in your isr, include the intsruction
       bsf     iflag

> circle  goto    circle
>
> waiting for an interupt.  when the isr is finished and I use the retfie
> command, will it increment the program counter to execute the instruction
> after this one? or if it doesn't is there a way that I can increment the
> program counter myself? thanks
>
> Jonathan Newport

1998\06\24@174335 by David Reinagel

picon face
> From spam_OUTjnewportTakeThisOuTspamMAIL.ORION.ORG Wed Jun 24 12:12:45 1998
> X-SMAP-Received-From: outside
> X-Comment: mitvma.mit.edu: Mail was sent by orions0.orion.org
> X-Sender: jnewport@orionc0
> MIME-Version: 1.0
> Date:         Wed, 24 Jun 1998 13:14:41 -0500
> From: "Jonathan M. Newport" <.....jnewportKILLspamspam@spam@MAIL.ORION.ORG>
> Subject:      after I return from an interupt...
> To: PICLISTspamKILLspamMITVMA.MIT.EDU
>
> sorry, I'm kind of new to this, but say I've got something in a continuous
> loop like:
>
> circle  goto    circle
>
> waiting for an interupt.  when the isr is finished and I use the retfie
> command, will it increment the program counter to execute the instruction
> after this one?

No, you return to the same loop.

> or if it doesn't is there a way that I can increment the
> program counter myself? thanks

No, you can't change the content of an item on the stack.  But you can
just re-enable interrupts at the end of your interrupt handler, and do
a goto to the instruction after the circle instruction, as long as you
don't need any addresses on the stack.  But if circle is in a subroutine
that you need to return from, you can't use this hack.  By the way, unless
you disable the watchdog timer, this loop will eventually cause a watch-
dog reset unless you clear the watchdog timer in the interrupt routine
and have the interrupt occur often enough.

Usaully what people do is have the interrupt routine send a flag for the
base level reoutine to continue.  For example

       bcf     some_status_byte,0;
circle  btfss   some_status_byte,0;
       goto    circle


and in the interrupt routine:

       ...
       bsf     some_status_byte,0;
       ...

>
> Jonathan Newport
>

1998\06\24@175208 by Mike Keitz

picon face
On Wed, 24 Jun 1998 13:14:41 -0500 "Jonathan M. Newport"
<.....jnewportKILLspamspam.....MAIL.ORION.ORG> writes:

>continuous loop like:
>
>circle  goto    circle
>
>waiting for an interupt.  when the isr is finished and I use the
>retfie
>command, will it increment the program counter to execute the
>instruction
>after this one?

No. When the interrupt is done, the program will continue in the endless
loop.

or if it doesn't is there a way that I can increment
>the
>program counter myself?

You can't change the program counter on the stack (Even if you could, it
wouldn't be a very good practice since you'd also have to be sure that it
was the endless loop that was interrupted).  The most flexible way to do
it is to have the ISR set a flag, then test the flag in the main program:

(flags is a byte in RAM, and isrdone is a constant from 0 to 7 indicating
the function of that bit in flags)

[In the ISR]
....
       bsf     flags,isrdone   ;Tell main program the int. has
occurred.
...
       retfie

[In the main program]
       bcf     flags,0         ;Interrupt hasn't occurred.
[Enable interrupts, etc.]
waitint btfss   flags,isrdone   ;Skip if flag is set
       goto    waitint         ;Otherwise keep waiting
;Here after interrupt.

This technique is very flexible.  For example, if the ISR is collecting
data being sent serially, it might not set the flag until after a whole
byte has been received.  The main program would then wait until the byte
is complete.

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

1998\06\25@072007 by Caisson
flavicon
face
> Van: Jonathan M. Newport <EraseMEjnewportspam_OUTspamTakeThisOuTMAIL.ORION.ORG>
> Aan: PICLISTspamspam_OUTMITVMA.MIT.EDU
> Onderwerp: after I return from an interupt...
> Datum: woensdag 24 juni 1998 20:14
>
> sorry, I'm kind of new to this, but say I've got something in a
continuous
{Quote hidden}

As you already have seen, the most general solution to your problem is to
check a 'not ready' bit that will be cleared in the interrupt-routine.
Another way could be, dependend on the Interrupt-source, to go into
'Sleep'-mode.  An interrupt will wake the system and you will continue
execution of your program.

Greetz,
 Rudy Wieser

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