any procedures in ISR - is it possible?

#1171674
Rate this post
• ▲ useful
▼ not useful
gregor wrote:
> Hi everybody,
>
> Is it possible to use an procedures/functions inside interrupt service
> routine?  What should I add/change in armVIC files in this case? When I
> try to use some LCD procedure in ISR my program doesn`t want to start. I
> use LPC2138 uC.
>
> Thanks in advance
> gregor

In general functions called from ISRs must be reenterant(unless they are
never called from anywhere else), and must not block - for example
calling printf() from an ISR is usually a bad idea for several reasons:
If the buffer is full, the function will not return until it becomes
empty, which it will never do if the UART interrupt is a lower priority
or if interrupts are switched off.

Systems usually switch to a different (and usually smaller) stack in the
interrupt context, so you need to be careful about stack (local
variable, and call depth) usage. Again using printf as an example, it
has a particularly large stack requirement and may crash an interrupt
routine.

So to answer your question it is probably a problem with nature of the
function you are calling. Another possibility is that you are installing
and enabling the ISR before the hardware is properly initialised. Before
enabling any interrupt it is usually important to clear any pending
interrupt before hand otherwise the ISR will be called immediatly. I
would be surprised if this was a simple 'configuration' problem, it is
more likely te be a fault with your code.


Clifford

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.