Thats the compiler's job. You can tell the compiler to save additional registers if you need to. ----- Original Message ----- From: "M. Adam Davis" To: Sent: Friday, November 03, 2000 12:43 PM Subject: Re: [PIC]: How do I assign functions to interrupts in MPLAB-C18? > Any time an interrupt occurs in a PIC with the GIE enabled, the code immediately > jumps to code at location 4, and places its previous location on the stack. (it > also disables GIE to prevent an endless interrupt jump to 0x04) > > That's it. > > If you want to assign a function to a particular interrupt, you'll need code at > location 4 to: > 1) Save the contents of status registers, W, > and other registers whihc will change in > your interrupt function code. > 2) Check each interrup flag of interest, call > its associated function, and reset the flag > 3) Restore the registers which you saved in > the beginning, and return from the > interrupt handler. > > So you are correct in saying that you'll essentially have to create code that > determines which interrupt occured as there is only one location for a 'main' > interrupt. > > -Adam > > Jeff Meyer wrote: > > > > Hi all. > > > > I want to write a program that responds to various interrupts (PORTB and > > USART specifically). I have been programming real time systems for many > > years and use interrupts all the time, and the interrupt model in that > > environment is one of "connecting" a procedure to a specific interrupt by > > defining the procedure and then assigning an interrupt to it (basically). > > Is that possible in MPLAB-C18? I see the "pragma interrupt" directive, but > > the examples I see generally have a "main" interrupt procedure that checks > > to see what interrupt occurred and then it calls a procedure based on that. > > That seems to be the model in the PIC18Cxx2 document as well. I don't see > > a method to assign say interrupts to functions or vice-versa. > > > > Thanks, > > Jeff. > > > > -- > > http://www.piclist.com hint: PICList Posts must start with ONE topic: > > "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads > > > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics