3v0Table of Contents
Introduction
What you must know
What you will need
Definitons
Sequential Execution
Cooperative Multitasking
NAOS Tasks
Finite State Machines
It's All About Timing
Multitasking = Tasks + Timing
kTimer's Math
A Second Task
Apendix A: Source Code
DJ_coop2.c
multiCompiler.h
Apendix B: Hardware
Connect your button to the interrupt pin and service it from the interrupt routine.OK I could constantly poll the button, but I would prefer to implement it using a real time system.
I agree. But I am not sure it would buy him much more then polling.Connect your button to the interrupt pin and service it from the interrupt routine.
Why is it difficult? 18F1320 has plenty of pins, many of which can be used as interrupt source.But I am using a 4*4 matrix keypad so this would be difficult
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.I agree. But I am not sure it would buy him much more then polling.
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.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.