Forums

How to write an ISR in UCOS-ii

Started by Prakhar October 2, 2007
Hello,
I am developing a program which creates many tasks, schedules them and
responds to external interrupts, when they ouccr.
In my program in UCOS-ii, I have enabled the external interrupts (the
values of the resgisters are set correspondingly).

Now, I want to write the interrupts handler for this ext interrupt.,
i.e, an ISR.

I tried the following ISR with an intention to write an external
interrupt handler:

#pragma interrupt_handler int0_isr:2
void int0_isr(void)
{
 count++;
}


On every occurrence of the interrupt, I am incrementing a count. SO it
should increase whenever an interrupt should occur.
But while interrupts are occurring, there is no increase in the value
of count.

Kindly suggest how to write an interrupt handler in UCOS-ii, so as to
handle the external interrupts.
Also, should I call this handler from the main function.?

Kindly suggest in this regard with your views and ideas.

Thanks.
Prakhar.

In short, I am asking how to write an external interrupt handler in
ucos-ii ?

Thanks & Regards,
Prakhar

On Oct 2, 3:09 pm, Prakhar <prakhargo...@gmail.com> wrote:
> Hello, > I am developing a program which creates many tasks, schedules them and > responds to external interrupts, when they ouccr. > In my program in UCOS-ii, I have enabled the external interrupts (the > values of the resgisters are set correspondingly). > > Now, I want to write the interrupts handler for this ext interrupt., > i.e, an ISR. > > I tried the following ISR with an intention to write an external > interrupt handler: > > #pragma interrupt_handler int0_isr:2 > void int0_isr(void) > { > count++; > > } > > On every occurrence of the interrupt, I am incrementing a count. SO it > should increase whenever an interrupt should occur. > But while interrupts are occurring, there is no increase in the value > of count. > > Kindly suggest how to write an interrupt handler in UCOS-ii, so as to > handle the external interrupts. > Also, should I call this handler from the main function.? > > Kindly suggest in this regard with your views and ideas. > > Thanks. > Prakhar.
"Prakhar" <prakhargoyal@gmail.com> wrote in message 
news:1191324329.324028.265030@50g2000hsm.googlegroups.com...
> In short, I am asking how to write an external interrupt handler in > ucos-ii ? >
First get the interrupt handler working without the presence of uCOS, then refer to your supplier of the source code (book, distributor, micrium, etc) to determine how to modify it to get it working under uCOS, if any modification is required at all. How do you expect people to answer your question when you make no reference to the processor or compiler you are using? -- Regards, Richard. + http://www.FreeRTOS.org 13 official architecture ports, 1000 downloads per week. + http://www.SafeRTOS.com Certified by T&#2013265948;V as meeting the requirements for safety related systems.
"Prakhar" <prakhargoyal@gmail.com> wrote in message 
news:1191324329.324028.265030@50g2000hsm.googlegroups.com...
> In short, I am asking how to write an external interrupt handler in > ucos-ii ? > > Thanks & Regards, > Prakhar > > On Oct 2, 3:09 pm, Prakhar <prakhargo...@gmail.com> wrote: >> Hello, >> I am developing a program which creates many tasks, schedules them and >> responds to external interrupts, when they ouccr. >> In my program in UCOS-ii, I have enabled the external interrupts (the >> values of the resgisters are set correspondingly). >> >> Now, I want to write the interrupts handler for this ext interrupt., >> i.e, an ISR. >> >> I tried the following ISR with an intention to write an external >> interrupt handler: >> >> #pragma interrupt_handler int0_isr:2 >> void int0_isr(void) >> { >> count++; >> >> } >> >> On every occurrence of the interrupt, I am incrementing a count. SO it >> should increase whenever an interrupt should occur. >> But while interrupts are occurring, there is no increase in the value >> of count. >> >> Kindly suggest how to write an interrupt handler in UCOS-ii, so as to >> handle the external interrupts. >> Also, should I call this handler from the main function.? >> >> Kindly suggest in this regard with your views and ideas. >> >> Thanks. >> Prakhar. > >
There are samples in various ports for uCOS. Check the micrium web site. The ports are free to download -- Scott Validated Software Corp.