Searching \ for '[PIC]: ISR from different pages' 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/microchip/devices.htm?key=pic
Search entire site for: 'ISR from different pages'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: ISR from different pages'
2003\02\13@121614 by Micro Eng

picon face
Its been a while since I've had to code into page 1.  If you have an ISR
being triggered by TMR0, such that it is always going into it, what happens
when you enter it from page1, make calls from the ISR into page0 then return
back to page1.

Does the stack contain the fact that you started in page1, so will it return
ok back there or do I (should I) disable interupts when I am running stuff
in page1

How deep is the stack for calls/returns?  This is on an 877 device

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@123059 by Jai Dhar

flavicon
face
Quoting Micro Eng <spam_OUTmicro_engTakeThisOuTspamHOTMAIL.COM>:

> Its been a while since I've had to code into page 1.  If you have an ISR
> being triggered by TMR0, such that it is always going into it, what happens
> when you enter it from page1, make calls from the ISR into page0 then return
> back to page1.
>
> Does the stack contain the fact that you started in page1, so will it return
> ok back there or do I (should I) disable interupts when I am running stuff
> in page1
>
> How deep is the stack for calls/returns?  This is on an 877 device

Unless there is more than one stack (which I don't think there is), according
to the f877 datasheet, it has an "eight level deep hardware stack".

That's all I can answer :-)
{Quote hidden}

----------------------------------------
This mail sent through http://www.mywaterloo.ca

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@123509 by Alan B. Pearce

face picon face
>How deep is the stack for calls/returns?  This is on an 877 device

Well the RTFM for the stack is 8 levels, of which one will be used for the
interrupt itself.

and if you use Olin's great development environment, he has included all the
necessary code to save and restore all necessary registers when entering and
leaving an interrupt routine, no matter what page the background code is in.
There is a certain amount of RTFM in this as well, as there are a number of
notes around that cover the necessary code to do the save and restores.
Check the PIC archives if all else fails.

You should seriously get Olin's PIC development code, as it gets rid of many
of the chores related to bank and page switching if you use the macros
sensibly.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@143000 by Wouter van Ooijen

face picon face
> > Does the stack contain the fact that you started in page1,
> so will it return
> > ok back there or do I (should I) disable interupts when I
> am running stuff
> > in page1

The stack stores all bits of the program counter, but note that when you
(must) change the pclath in the interrupt you *must* restore it, as it
is *not* saved/restored on the stack.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@143623 by Olin Lathrop

face picon face
> Its been a while since I've had to code into page 1.  If you have an ISR
> being triggered by TMR0, such that it is always going into it, what
happens
> when you enter it from page1, make calls from the ISR into page0 then
return
> back to page1.

Nothing unusual as long as the interrupt routine saves PCLATH, does
whatever it wants with it, then restores it before returning.  There is
nothing magic about interrupt code.  The processor has no notion of being
"in" an interrupts.  All code is the same.

> Does the stack contain the fact that you started in page1, so will it
return
> ok back there or do I (should I) disable interupts when I am running
stuff
> in page1

The full 13 bit return address is always pushed onto the stack, just like
the manual clearly states.

> How deep is the stack for calls/returns?  This is on an 877 device

This is getting silly.  RTFM.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@150003 by Dwayne Reid

flavicon
face
At 10:13 AM 2/13/03 -0700, Micro Eng wrote:
>Its been a while since I've had to code into page 1.  If you have an ISR
>being triggered by TMR0, such that it is always going into it, what happens
>when you enter it from page1, make calls from the ISR into page0 then return
>back to page1.

You have mess with PCLATH if you have *any* goto or call statements in your
ISR code.  If your ISR is very simple with no goto statements, you are OK.

The problem occurs if you have even just one single goto or call statement:
the statement needs PCLATH set correctly so that you wind up in the correct
page.

The cure is simple: save PCLATH as part of your context save, then set
PCLATH to the correct value for the ISR.  Make sure you restore PCLATH to
what it was when you restore context.

>Does the stack contain the fact that you started in page1, so will it return
>ok back there or do I (should I) disable interupts when I am running stuff
>in page1

The stack contains the full return address.

dwayne

--
Dwayne Reid   <.....dwaynerKILLspamspam@spam@planet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 19 years of Engineering Innovation (1984 - 2003)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

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