TOP Contributors

  1. MIKROE (2657 codes)
  2. Alcides Ramos (354 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136888 times)
  2. FAT32 Library (70023 times)
  3. Network Ethernet Library (56002 times)
  4. USB Device Library (46308 times)
  5. Network WiFi Library (41934 times)
  6. FT800 Library (41210 times)
  7. GSM click (29017 times)
  8. PID Library (26432 times)
  9. mikroSDK (26401 times)
  10. microSD click (25386 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Library

RTOS for PIC32

Rating:

5

Author: dany

Last Updated: 2017-09-30

Package Version: 1.2.0.0

Category: Other Codes

Downloaded: 3011 times

Followed by: 3 users

License: MIT license  

Pre-emptive RTOS for PIC32, written (almost entirely) in mikroPascal/mikroBasic/mikroC.
The way of working is very easy to understand. The functionality is kept very limited with respect to other RTosses, to keep it simple.
The library code only consists of 1 .mpas file...

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "RTOS for PIC32" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "RTOS for PIC32" changes.

Do you want to report abuse regarding "RTOS for PIC32".

  • Information
  • Comments (3)

Library Blog

Pre-emptive RTOS (scheduler) for PIC32 and mP/mB/mC PRO.

Features:

- Delays in tasks performed by the RTOS (using OS_Delay in stead of delay_ms), giving other tasks the possibility to execute during that waiting time.
- Binary and Counting semaphores, with or without timeout.
- Starting, stopping and replacing (stop current task, start another one) tasks.
- Signalling semaphores both from interrupts and the main thread.
- Task priorities (priority 0 being the highest one)

- Tasks are executed in the main thread, not in an interrupt routine.
- The RTOS timebase is timer 1, using interrupt priority 6 (to prevent the usage of the shadow register set). So, all timed activities have a resolution of 1 timertick. A very suitable value for 1 timertick is e.g. 1 millisecond.
- The max task execution time is 10 timerticks. This is the longest time a task will be executed, after that another task (or the same, depending on eligibility of other tasks) will be chosen for execution. If a task is pre-empted by another one the execution time will be shorter of course.
This automatic task switching every 10 timerticks can be disabled by defining a compiler directive. Doing this the RTOS becomes a CRTOS (cooperative RTOS).
- Pre-emptive (if a task with a higher priority than the current one executed becomes eligible then it gets executed first)
- Tasks with the same priority are executed in a "round Robin" (sequential with wrap around) manner.
- Idle procedure (optional)
- Stack usage measurement (optional)
- Critical sections in the tasks are possible.

Have fun!

Keywords:

- scheduler
- pre-emptive
- priority
- semaphore
 


2015-07-30: Changed the documentation (stack usage function) and the library dependancies in the package.


2015-08-06, version 1.1:

- Added the "Critical Section" procedures (Enter- and LeaveCriticalSection)
- R1 is not part of the context any more (GP never changes)
- Made the Timer1Int routine does not make any "calls" anymore (could give problems)


2015-08-09, v 1.2:

- Added OS_NO_AUTO compiler directive (in RTOS_Defines.pld) to disable automatic task switching,  setting this directive makes the system a cooperative RTOS (CRTOS)
- Always restart the 10 timerticks counter when a new task is (to be) selected
- Forced the first task selection now (in OS_Run): faster starting of first task
- Added the "Check_Events_ISR" again in the semaphore test/read routines to prevent 1 timertick delay
- Made "RestoreInterrupts" inline code. (no calls are allowed in the timebase interrupt routine)


2015-08-14:
- Added the instructions "DI" and "EHB" to the epilogue code of the OS interrupt routine.
- Fetched the interrupt Priority from the "Cause" coprocessor register to put in the "Status" register
- Added always a "rdpgpr sp, sp" to the beginning of the interrupt prologue


2015-08-16: Added the mB version of the library (not tested, only compiled). 


2015-09-20: Updated the examples: the memory manager was not initialised in them... Sorry for the inconvenience.


2015-09-21: Added, thanks to aCkO the mC for PIC32 version package (.mpkg) and the updated the zip file. I hope there is a lot of interest from the mC community!

ALSO FROM THIS AUTHOR

PS2 Mouse Read

5

Returns the Delta X (hor), the Delta Y values (vert), the Delta Z (scrolwheel) values and the button status if one of those has changed. Only tested on P18 with 48 MHz MCU clock (will work probably also on 16 and on lower MCU clock speeds).

[Learn More]

Tool: RomSizes

10

This tool shows the romsize of all units of a project together with rom-size details of a selected unit.
For mP, mC and mB for PIC, dsPIC and PIC32.

[Learn More]

Tool: PIC Clear project

5

This tool enables you, in case of troubles, to delete the derived files (*.mcl etc...) in the project directories and the "Defs" directory. It also enables you to edit/check the .mpppi (project) file. For: mP for PIC, dsPIC and PIC32.

[Learn More]