TOP Contributors

  1. MIKROE (2653 codes)
  2. Alcides Ramos (352 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 (136721 times)
  2. FAT32 Library (69928 times)
  3. Network Ethernet Library (55939 times)
  4. USB Device Library (46264 times)
  5. Network WiFi Library (41884 times)
  6. FT800 Library (41168 times)
  7. GSM click (28979 times)
  8. PID Library (26412 times)
  9. mikroSDK (26357 times)
  10. microSD click (25355 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: 3000 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

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]

RC5_RC6_decoders

11

RC6 and RC6 (Philips IR remote control system) decoders, decodes the Rc5/6 toggle, Rc5/6 System and Rc5/6 command. For the moment only RC6 "mode 0" (most used) can be decoded. Made for 36 Khz IR receivers with inverse output (= output active low), like the TSOP1736. -- for P16F627A, 628A, 648A --

[Learn More]

Rotary Encoder

5

Simple timer interrupt based Rotary Encoder decoding library.

[Learn More]