Searching \ for '[PIC]: Real time thread in microcontroller' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/time.htm?key=real+time
Search entire site for: 'Real time thread in microcontroller'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Real time thread in microcontroller'
2003\04\03@091149 by Lim KK

picon face
Hi everyone,
I am thinking of creating a real time thread in a microcontroller. In normal
linux program, this can be done by assigning a interrupt priority level to
the particular piece of code.

In microcontroller, how is such a task normally carried out? I though of 2
ways though I do not know whether they are correct or not.

Method 1:
Let the piece of code stay within a while loop and make sure there are no
other processes that can interrupt it.
This could be bad because there may be other tasks that needs attention.

Method 2:
Create a timer that has the highest level of interrupt priority.

Is there any C function within MPLAB C18 compiler that caters to real-time
processes?

As a general guideline, should the highest priority be assigned to those
"more important" routines with long execution time or to those routines
which can be executed to completion in the shortest time?

Thanks
Mark





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

--
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

2003\04\03@161631 by Brendan Moran

flavicon
face
>Method 1:
>Let the piece of code stay within a while loop and make sure there are no
>other processes that can interrupt it.
>This could be bad because there may be other tasks that needs attention.

This isn't really a good idea.  If you let it be interruptible, it would be
ok, but since it's supposed to be realtime, that's not good.

>Method 2:
>Create a timer that has the highest level of interrupt priority.

This is a much nicer method.

>Is there any C function within MPLAB C18 compiler that caters to real-time
>processes?

Ok, so you're using an 18-series PIC, which definitely makes it easier to
implement this.  I would recommend using the Tmr0 overflow to  keep your
real time thread happening.  And make it a high priority interrupt.  Try to
keep your other high priority interrupts to a minimum.

>As a general guideline, should the highest priority be assigned to those
>"more important" routines with long execution time or to those routines
>which can be executed to completion in the shortest time?

You can debate over this a lot, I think it comes out to two different
schools of thinking.

--Brendan

--
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

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