|
Myke's Home Page
Book CD-ROM Home
File Copying/Harddrive Setup
Development Tools
Experiments
Projects
Useful Code Snippets and Macros
Introduction to Electronics
Introduction to Programming
Datasheets
PCBs
Links
|
"RTOS2" Project
The following application is one that I have implemented quite a few times
for different books. It is actually quite a good one to demonstrate the operation of an
RTOS.
Click Here to look at the PICmicro MCU
source code.
The circuits used for this application are:
The bill of materials for this application is listed in the table below.
| Part |
Description |
| PIC18C452 |
PIC18C452-JW |
| 4 MHz |
4 MHz Ceramic Resonator with Internal Capacitors |
| 10K |
3x 10K, 1/4 Watt Resistors |
| 10K Pot |
10K, Single Turn Potentiometer |
| 0.1 uF |
0.1 uF, 16 Volt Tantalum Capacitor |
| Button |
Momentary On Push Button |
| LCD |
16x2, Hitachi 44780 based LCD |
| Miscellaneous |
Prototyping Card, Wiring, +5 Volt Power Supply |
The RTOS Template code can be accesseed
by clicking Here.
The RTOS system requests are listed in the table below:
| RTOS Request |
Input |
Output |
Macro |
| Start Task |
- Starting Address
- Priorty
- File Register Size Requirements |
- Carry Reset, OK and New Task Number in "WREG"
- Carry Set, NO Available Tasks or more than 63 Task Variables Requested |
TaskStart Address, Priority, Size
Address, Priority and Size are all constants |
| Next Task |
None |
None |
TaskNext |
| Wait for Interrupt |
- Interrupt Number |
None |
IntWait Interrupt
Interrupt is a Constant |
| Send Message |
- Task Number
2 Byte Message in FSR0L/FSR1L |
None |
MsgSend TaskNumber
TaskNumber is a Variable |
| Wait for Message |
None |
- 2 Byte Message in FSR0L/FSR1L
TaskNumber in WREG |
MsgWait |
| Read Message |
- Task Number |
- Carry Reset 2 Byte Message in FSR0L/FSR1L
- Carry Set, no message to receive |
MsgRead TaskNumber
TaskNumber is a Variable |
| Ack Message |
- Task Number |
- Carry Reset Operation Complete
- Carry Set, no message to acknowledge |
MsgRead TaskNumber
TaskNumber is a Variable |
The Interrupt List and Numbers are:
| Interrupt Number |
Interrupt Source |
Register Location |
| 0 |
TMR1 |
PIR1 |
| 1 |
TMR1 |
PIR1 |
| 2 |
CCP1 |
PIR1 |
| 3 |
SSP |
PIR1 |
| 4 |
USART TX |
PIR1 |
| 5 |
USART RX |
PIR1 |
| 6 |
AD |
PIR1 |
| 7 |
PSP |
PIR1 |
| 8 |
CCP2 |
PIR2 |
| 9 |
TMR3 |
PIR2 |
| 10 |
LVD |
PIR2 |
| 11 |
BCL |
PIR2 |
| 12 |
RB |
INTCON |
| 13 |
INT0 |
INTCON |
| 14 |
TMR0 (16.384 msec delay) |
INTCON |
| 15 |
Not Avaliable |
Used by the RTOS |
|