Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


1131 runtime on FreeRTOS with PIC

Posted by Mihai on March 11, 2010
Hello guys,

I’d like to check if FreeRTOS suits to my demand to run it in a microcontroller such as PIC18, or dsPIC from Microchip in order to hide their hw details for a new application: a microPLC that is able to support a 61131 runtime for PLC automation projects.

For those that don’t know, in principle, a 1131 runtime is a forever loop that first reads the INPUTs of an I/O list (values being sampled beforehand based on interrupts), then process these inputs variable in a simple logic (AND/OR, .... sometimes more complex math like translating engineering units degree->radians, etc) with a dataflow imposed by various timers (TON, TOFF, ...), and writes the OUTPUTs back to the hardware.

Basically, looking at FreeRTOS design, I think that this 1131 runtime is a high-priority task together with an idle task for power-saving (sleep moments). In addition we also have the data acquisition component (that is interrupt driven). So, I don’t have lots of tasks, nor a complex priority scheme.
I personally don’t know if it’s useful to have a RTOS (and its overhead) on small microcontrollers such as PICs, for the application I described above with 1131 runtime. I wonder because one of the biggest problem in implementing 1131 runtime is supporting of various timers (hopefully using HW timers as available by specific PIC) and FreeRTOS doesn’t support hw specific timers, nor allow custom timers (I’ve read this post: http://sourceforge.net/projects/freertos/forums/forum/382005/topic/3585958). In our 1131 runtime, we need timers to enable/disable various branches of the dataflow (e.g. code if/then/else, switch) within this task, not necessarily enabling other tasks.

I don’t know if you have met such application which requires a 1131 runtime, but if you do, please share the good/bad experience.

Kind regards,

RE: 1131 runtime on FreeRTOS with PIC

Posted by Richard on March 11, 2010
In my experience PLCs generally sample inputs at a fixed frequency, whereas RTOS based designed benefit most from event driven architectures (where lots of time can be saved because the need to poll is completely removed).

There is no reason why you could not implement this in an RTOS, especially if you have multiple communication interfaces that need services (as is common in PLCs) which is another area you are likely to see benefits. If the overall CPU load was relatively low, and power consumption was not an issue, then I'm sure you could just as easily do it bare back.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists