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


Reset Task

Posted by Nobody/Anonymous on May 10, 2006

I have a question...

Is it possible to reset a task?

For example:

if i have the task like this

static portTASK_FUNCTION( vLightsTask, pvParameters )

initSomeThings();<----- RESART HERE

CASE (flash_fast):
vTaskDelay(1000);<-------------- HERE
CASE (flash_slow)

This task is running and it currently is a delay.

From another function i want to be able to resart the task, so it would remove it from the delay and start over.

I guess i could delete the task and then re-create it but i thought this might take too long, is there another way

If i am not making sense let me know and i will try and explain.



RE: Reset Task

Posted by Nobody/Anonymous on May 10, 2006
Just some more background on what i am doing.

I have 1 task that implements about 8 different LED flashing algorithms.

I have a global varible that indicated that algorithm is currently set.

This varible is check in the task and then the LED algorithm is executed.

I have a function that is called to set the current algorithm,
If this function is called i want the task to stop what it is doing and start the new algorithm.

Currently it has to wait 1 cycle before it starts the new one.

Would i be better looking a using co-routines, 1 for each LED algorithm.


RE: Reset Task

Posted by John W. on May 10, 2006

Have you looked at the API functions:

vTaskSuspend() and vTaskResume()?

Can't you do what you want with these?
There's also a tickHook() that can
be implemented.

John W.

RE: Reset Task

Posted by Nobody/Anonymous on May 10, 2006
How about, instead of blocking using a delay, block on a queue read. Then if you want to change algorithms during the delay you wake the task by posting to the queue. The task recognises it has been woken before the end of the delay by the xQueueRead return value.

You could even get rid of the global variable then and post the algorithm that should be run on the queue.

RE: Reset Task

Posted by Nobody/Anonymous on May 11, 2006
yeah the suspend and resume doesn't do what i want. IF i suspend the task, then resume it, it contines from where it was, thus still executing the complete cycle.

The queue read sounds like a possibility. I will have a think about that a little more. Thanks

[ 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