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




Loading

Periodic Task that also call from interrupt.

Posted by valeriv on July 26, 2016

Hello to all. I have GUI task that it's main purpose to redraw windows and to react on pressing buttons. So I thought that the best way redraw window every 200 miliseconds (vTaskDelay(200)), and also I want to call it from Keyboard Interrupt. I redraw window periodicly, because the data on it can be changed. So, I can't use vTaskSuspend.

Help me, please, how can i do this ? Thanks in advance Valerie


Periodic Task that also call from interrupt.

Posted by valeriv on July 26, 2016

I think, may be, the gui task after redraw window will set itself to suspend state. And resume it from timer every 200 mili and from the keyboard interrupt. ???

Attachments

alternate (733 bytes)

Periodic Task that also call from interrupt.

Posted by valeriv on July 26, 2016

If I will run the gui Task in loop with Delay(200) , how can I break the DELAING state from keyboard interrupt ?


Periodic Task that also call from interrupt.

Posted by davedoors on July 26, 2016

From a task you can use http://www.freertos.org/xTaskAbortDelay.html but I'm not sure if there is a FromISR version.


Periodic Task that also call from interrupt.

Posted by rasty1 on July 26, 2016

I'd recoment to use semaphore with Delay option instead of vTaskDelay. If you need to interrupt, just give a semaphore.


Periodic Task that also call from interrupt.

Posted by valeriv on July 26, 2016

Hi Dave, thanks for your answer. But I really don't see FromISR version. How I can check if it is right solution for my problem ?


Periodic Task that also call from interrupt.

Posted by valeriv on July 26, 2016

Hi, Rasty. Can you, please, give me an example of your solution. If I understand right, the gui task take semaphore in the end of it's loop.. In keyboard interrupt I can give semaphore back. What about call gui task every 200 mili ? Return semaphore from timer ?

Can you explain your solution again ?

Attachments

alternate (890 bytes)

Periodic Task that also call from interrupt.

Posted by rasty1 on July 26, 2016

I hope that I understand correcly the problem. You have to redraw screen each 200 ms. Sometimes trigger extra redraw from Interrupt or other context.

while (1) { xSemaphoreTake(sem, 200); // will leave xSemaphoreTake after 200 msecs (with error) or earlier if sem is given. redraw(); }

from other task/interrupt xSemaphoreGive(sem)


Periodic Task that also call from interrupt.

Posted by valeriv on July 27, 2016

Thanks a lot to you, Rasty


Periodic Task that also call from interrupt.

Posted by rtel on July 27, 2016

You can also do the same thing in a more efficient way using a direct to task notification in place of a semaphore.

http://www.freertos.org/RTOSTaskNotificationAsCounting_Semaphore.html


Periodic Task that also call from interrupt.

Posted by valeriv on July 28, 2016

thank you very much


[ 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