Friday, April 22, 2011

New Software Timers in FreeRTOS under MS Windows

SW Timers
Embedded applications need to schedule future events. This can be accomplished using timers and timers' services.

Timers are an integral part of any real-time system. A timer can be seen as an event scheduling according to a predefined time value in the future, exactly like setting an alarm clock.

Embedded systems that have time-sensitive activities use 2 types of timers; hard-timers and soft-timers. Hard timers are based on physical timers on the chip that directly interrupt the CPU. A hard-timer is a must in case of an application demanding high precision and predication. On the other hand soft-timers are scheduled through a software facility that enables soft-timer's maintenance, installation, and removal.

But if hard-timers are more accurate than their soft counterparts, why are they used? The answer is in their nature. The can be programmed with timeouts of course granularity. In addition, the high-precision is not always needed in most of embedded systems. Another prevailing reason is reducing system interrupt overhead. Facilities of soft-timers are built using only 1 hardware-timer.

SW Timers in FreeRTOS
Starting from FreeRTOS V7.0.0, FreeRTOS added the soft-timers feature. FreeRTOS timers have 2 modes of operations; autorelaod and 1-shot modes. Whenever a timer timeouts, a callback function is executed. This service is implemented as a FreeRTOS kernel task and a FreeRTOS queue. This task is assigned a stack size and priority defined the macros configTIMER_TASK_STACK_DEPTH and configTIMER_TASK_PRIORITY respectively. The timers APIs are implemented through the queue. Whenever a task calls a timer API it send s a command to the timer task through the timers queue. This task continually gets the next expire time, either process the expired timer or blocks until a timer expires or  it receives a command  and processes it. Like any other FreeRTOS service, this service is highly configurable. In order to use it you have to:
  1. Define configUSE_TIMERS to 1
  3. Define configTIMER_QUEUE_LENGTH
  4. Add FreeRTOS/Source/timers.c to your application.
  5. Use the timers in your application

Demoing the SW Timers under MS Windows
Last year, I showed how to run the industrial PC port under MS Windows. Recently, FreeRTOS team made a windows simulator. Unlike the PC port that used Open Watcom and 80x86 assembly, it uses MS VC or MingW and Windows APIs. 

The following steps shows how to test the SW timers with the FreeRTOS MS Windows simulator:
  1. Download MS VC++ 2010 Express edition from here.
  2. After Installing the compiler, download FreeRTOS from here.
  3. Open the project using MS VC and here you go.


  1. However if hard-timers end up being more valid when compared to their cushy alternatives, the reasons why are really they used? The answer is within their character. The can feel programmed with timeouts naturally granularity. In addition, the high-precision is certainly not always needed in many of embedded techniques. An additional prevailing cause is decreasing system interrupt overhead. Amenities of soft-timers are built using just 1 hardware-timer.automateandvalidate

  2. Our Embedded Training Institute Provides 100 % Training & Placements. Embedded (8051, PIC, AVR, RTOS).Projects also Provides in Best & affordable fees Structure.Call @ +91-9940426826 / 044-26209369.
    Best Embedded Systems Training Institute

  3. Thank you for this awesome and wonderful post!! keep it up!
    Crack Software Download

  4. Amazing discussion on software technology. Go ahead and update us through these type of posts Adobe Photoshop Serial Number Free Download

  5. Thanks for sharing wonderful blog. For Embedded Training in Chennai Visit Fita Academy Embedded system Training in Chennai

  6. Thanks for sharing this article which content Contact No, Toll free no and address of Flipkart customer care
    Flipkart Toll Free No

  7. Welcome to Wiztech Automation - Embedded System Training in Chennai. We have knowledgeable Team for Embedded Courses handling and we also are after job placements offer provide once your successful completion of Course We are Providing on Microcontrollers such as 8051, PIC , AVR, ARM7, ARM9, ARM11 and RTOS. Free Accommodation, Individual Focus, Best Lab facilities, 100% Practical Training and Job opportunities.

    Embedded System Training in chennai
    Embedded System Training Institute in chennai
    Embedded Training in chennai
    Best Embedded System Training in chennai
    Embedded System Training in chennai
    Best Embedded System Training Institutes in chennai

  8. Embedded system training: Wiztech Automation Provides Excellent training in embedded system training in Chennai - IEEE Projects - Mechanical projects in Chennai. Wiztech provide 100% practical training, Individual focus, Free Accommodation, Placement for top companies. The study also includes standard microcontrollers such as Intel 8051, PIC, AVR, ARM, ARMCotex, Arduino, etc.

    Embedded system training in cehnnai
    Embedded training in chennai
    Best Embedded system training in chennai
    Embedded sytsem training institute in chennai
    Embedded projects in chennai
    VLSI training in chennai
    VLSI training institute in chennai

  9. CIITN is located in Prime location in Noida having best connectivity via all modes of public transport. CIITN offer both weekend and weekdays courses to facilitate Hadoop aspirants. Among all Hadoop Training Institute in Noida , CIITN's Big Data and Hadoop Certification course is designed to prepare you to match all required knowledge for real time job assignment in the Big Data world with top level companies. CIITN puts more focus in project based training and facilitated with Hadoop 2.7 with Cloud Lab—a cloud-based Hadoop environment lab setup for hands-on experience.

    CIITNOIDA is the good choice for Big Data Hadoop Training in NOIDA in the final year. I have also completed my summer training from here. It provides high quality Hadoop training with Live projects. The best thing about CIITNOIDA is its experienced trainers and updated course content. They even provide you placement guidance and have their own development cell. You can attend their free demo class and then decide.

    Hadoop Training in Noida
    Big Data Hadoop Training in Noida

  10. Thanks for such important information.keep up the good work.Ethical Hacking training is based on current industry standards that helps attendees to secure placements in their dream jobs at MNCs. Indian Cyber Army Provides Best Ethical Hacking Training in India.Indian Cyber Army credibility in Ethical hacking training & Cybercrime investigation training is acknowledged across nation as we offer hands on practical knowledge and full assistance with basic as well as advanced level ethical hacking & cybercrime investigation courses

  11. Thanks for Sharing this great article..Its really nice and useful for us… keep sharing..
    CEH Training In Hyderabad