TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 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 (139568 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57256 times)
  4. USB Device Library (47631 times)
  5. Network WiFi Library (43221 times)
  6. FT800 Library (42566 times)
  7. GSM click (29932 times)
  8. mikroSDK (28292 times)
  9. PID Library (26934 times)
  10. microSD click (26309 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: 3171 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

OW_Utilities for PIC32

5

This library provides the basic one-wire search ROM and search ALARM routines, e.g. for the DS1820, the DS18S20 and the DS18B20.

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

Menus for PIC32

5

Menu machine capable of handling text based menus. It only handles the logical behaviour of the menu(s), not their physical appearance e.g. on an LCD: the using project should still define the display or drawing procedures.

[Learn More]