I was working on PIC24fJ128GA202 microcontroller for 2 months, Since my application getting more complicated i decided to program on multitasking in pic microcontroller it is much complicated to do multitasking without RTOS . I am using XC16 compiler and Maplab 8.92 v . Can anyone suggest me how to start working in RTOS for 16 bit Microcontroller using XC 16 compiler?. I google it, but i dont get any clear idea and also i found some code GITHUB.com.
-
2What type of system you are designing.? What features will it provide.? Do you really think your application require FreeRTOS support because RTOS has a huge source code. You cannot manually add it into your program, instead you will have to edit the source code of FreeRTOS and add your aplication into it. So its better look at your application in depth first and trying solving your problem using interrupts if possible, because FreeRTOS will make your program more complex. I would suggest you to use it only if you have no other option left and your code include many module which runs parallel – Aircraft Oct 08 '15 at 08:49
-
1You can also have a look at [this](http://electronics.stackexchange.com/questions/193960/multitasking-on-pic-microcontrollers) & [this](http://electronics.stackexchange.com/questions/824/rtos-for-embedded-systems) question too.! – Aircraft Oct 08 '15 at 08:52
2 Answers
You can just download it and try it: http://www.freertos.org/portpic24_dspic.html
because RTOS has a huge source code
Huge is a relative term - if, without using the RTOS, you have to structure your code as a set of state machines, and explicitly include lots of timing information in your code, and changing to use an RTOS means the structure of your code become much simpler, and the timing is instead managed by the RTOS, then the difference in code size with and without FreeRTOS might not be much different.
because you are adding unnecessary overhead on your microcontroller
This misconception is deeply rooted in the embedded industry. Without an RTOS you might have to poll interfaces continuously, or look for state changes in a state machine continuously - both a waste of valuable CPU time. With an RTOS you can structure you code to be 100% event driven, with the CPU in sleep mode most of the time, and therefore only use CPU time when there is actually productive processing to perform. That is not adding an overhead, it is removing an overhead.
....but I agree, you should use the most optimal design choice for your individual application, and only people who have knowledge of the system requirements can make the decision as to whether it is better with or without an RTOS.

- 401
- 2
- 1
Try OpenRTOS by Wittenstein, which is ported for a PIC24. Essentially, a version of freeRTOS with added support.
I agree with CZAbhinav, use it only if you have to because you are adding unnecessary overhead on your microcontroller. Most versions of freeRTOS use a 1ms timer (very slow) and do not guarantee realtime operation.
Unless you are designing your system for human interaction, like button presses etc... where it is not so time critical then yeah use a RTOS. Anything else you are probably better off re-optimizing your code to make it simpler.

- 21
- 5
-
FreeRTOS also supports [PIC24](http://www.freertos.org/portpic24_dspic.html). – erebos Oct 08 '15 at 12:22
-
Yes that is correct. As I mentioned OpenRTOS is freeRTOS. Wittenstein have added support and hence renamed it to OpenRTOS. – Tinez Oct 28 '15 at 14:05