RTOS for a 18F1320

Status
Not open for further replies.

GreenP

New Member
Hi
Could anyone please help me with the basic understanding of RTOS implemented in C, which incorporates a single interrupt routine at regular frequent time intervals, as I am struggling with the basic concept in the C language.

Thanks GreenP
 
I have good feedback on this cooperative multasking tutorial. You may be looking for time-slice which is very difficult to do on a uC. In any case this will teach you about non blocking IO and delays.

BoostC - C18 Tutorials : Cooperative Multitasking


3v0
 
Thanks for the reply blueroomelectronics

What I am attempting to do is build a single digit calculator which I have working besides the clear button which should have a frequent share of the CPU. OK I could constantly poll the button, but I would prefer to implement it using a real time system.

Thanks
 
It sounds like you are looking for a quick fix. Any RTOS is going to be more work then I THINK you want to do.

POLL IT.

The cpu is idle most of the time so polling is not a problem.

3v0
 
Connect your button to the interrupt pin and service it from the interrupt routine.
I agree. But I am not sure it would buy him much more then polling.
He is still going to need to check the flag set by the int code in same places he would have polled.

3v0
 
Thanks felis

But I am using a 4*4 matrix keypad so this would be difficult, anyway I would like to get my head around an interrupt routine.

Thanks
 
I have a 4*4 matrix keypad connected to portB and a sevensegment display connected to portA, therefore using all the pins.
 
If I make use of TMR1 for two seperate timming intervals so that the routine checking the status of the clear button and the other performing the other functions, what interrupt flags are set, and how is it possible for the routine running at the time to see that interrupt flag and subsequently return to the code implementing the timmed interrupts?

GreenP
 
I agree. But I am not sure it would buy him much more then polling.

You don't need to poll. You can make this calculator with two interrupt routines and one state machine. A keyboard is connected to port b, rows to lower half, columns to upper. One interrupt is triggered by timer and scans the next row. Another one is triggered by change of portb4-7 and changes the value of state machine state variable.
 
There is no need for an RTOS and the only interrupt I would implement would be for multiplexing a display (not required in this case) and for timing purposes. I would simply read the keyboard every 10mS and execute the required code. Why would any key require priority? The code execution should be faster than you can press keys and so the Clear button should get acted upon immediately.

Mike.
 

I agree with Pommie, there's no reason to want an RTOS for such a simple project (and probably hardly ever any need anyway), simply poll the keyboard and it will be far faster than you could possibly require.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…