Hi What are the differences between ISR and a subroutine in embedded systems, how about the following: - interrupts are disabled by the microprocessor prior to calling the isr - isr's are always smaller - an isr cannot be written in C - a subroutine always has arguments - the CPU flags are stored on the stack in addition to the return address Thanks
Differences between interrupt service routine (ISR) and a subroutine
Started by ●November 28, 2006
Reply by ●November 28, 20062006-11-28
"2005" <uws2003@yahoo.com> wrote in message news:1164736936.337323.40270@j44g2000cwa.googlegroups.com...> HiThis is another homework question isn't it?> What are the differences between ISR and a subroutine in embedded > systems, how about the following: > - interrupts are disabled by the microprocessor prior to calling the > isrNot always - google for nested interrupts.> - isr's are always smallerNot necessarily. ISRs _should_ be kept small but that doesn't always happen.> - an isr cannot be written in CNot true but when written in C you normally need an attribute to tell the compiler that the function is to be an ISR.> - a subroutine always has argumentsNot true. void Subroutine(void); is a perfectly acceptable prototype.> - the CPU flags are stored on the stack in addition to the return > addressThat is true (although I suspect some pedants will find an example of systems that don't).
Reply by ●November 28, 20062006-11-28
In article <1164736936.337323.40270@j44g2000cwa.googlegroups.com>, uws2003@yahoo.com says...> Hi > > What are the differences between ISR and a subroutine in embedded > systems, how about the following: > - interrupts are disabled by the microprocessor prior to calling the > isrNot always true.> - isr's are always smallernot true> - an isr cannot be written in Cdefinitely just wrong> - a subroutine always has argumentsnope> - the CPU flags are stored on the stack in addition to the return > addressDepends on the CPU> > ThanksNo problem
Reply by ●November 28, 20062006-11-28
Thanks and wondering if - difference between an isr and a subroutine is that an isr has no arguments is true or not?
Reply by ●November 28, 20062006-11-28
In article <1164739817.612931.190780@l39g2000cwd.googlegroups.com>, uws2003@yahoo.com says...> > Thanks and wondering if > - difference between an isr and a subroutine is that an isr has no > arguments > is true or not? >Since you don't know what is in the resisters when the ISR is jumped to the idea of function arguments is meaningless.
Reply by ●November 28, 20062006-11-28
Tom Lucas wrote:> > - the CPU flags are stored on the stack in addition to the return > > address > > That is true (although I suspect some pedants will find an example of > systems that don't).:) The ARM CPU copies the return address and the CPU flags into special registers. If you need reentrant interrupts, you need to copy them to the stack yourself.
Reply by ●November 28, 20062006-11-28
"James Beck" <jim@reallykillersystems.com> wrote in message news:MPG.1fd6562aaec84d6d989d8e@newsgroups.bellsouth.net...> In article <1164739817.612931.190780@l39g2000cwd.googlegroups.com>, > uws2003@yahoo.com says... >> >> Thanks and wondering if >> - difference between an isr and a subroutine is that an isr has no >> arguments >> is true or not? >> > Since you don't know what is in the resisters when the ISR is jumped to > the idea of function arguments is meaningless.Well I can see some good uses for interrupts with arguments, making interrupt routines even easier to write in C. I'm sure someone has patented the idea already as it is quite obvious... Wilco
Reply by ●November 28, 20062006-11-28
On 2006-11-28, Wilco Dijkstra <Wilco_dot_Dijkstra@ntlworld.com> wrote:>> Since you don't know what is in the resisters when the ISR is >> jumped to the idea of function arguments is meaningless.The unstated assumption seems to be that function arguments are passed in registers?> Well I can see some good uses for interrupts with arguments, > making interrupt routines even easier to write in C. I'm sure > someone has patented the idea already as it is quite obvious...Obvious but impossible (in general). The hardware designer has no way of knowing how the ISR is going to expect arguments to be passed. If varies from one language to the next, from one compiler to the next, and even from one build to the next when compiler flags are changed. -- Grant Edwards grante Yow! My life is a patio at of fun! visi.com
Reply by ●November 28, 20062006-11-28
On 28 Nov, in article <1164736936.337323.40270@j44g2000cwa.googlegroups.com> uws2003@yahoo.com "2005" wrote:>Hi > >What are the differences between ISR and a subroutine in embedded >systems, how about the following:Sounds like a homework question, you want somebody else to answer for you. Hint see if you can find a difference between interupts and functions on NON embedded systems.>- interrupts are disabled by the microprocessor prior to calling the >isr >- isr's are always smaller >- an isr cannot be written in C >- a subroutine always has arguments >- the CPU flags are stored on the stack in addition to the return >addressWell I suggest you go back and read the book again, as these appear to be badly copied from a text book. -- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.gnuh8.org.uk/> GNU H8 & mailing list info <http://www.badweb.org.uk/> For those web sites you hate
Reply by ●November 28, 20062006-11-28