Amazing technological breakthrough possible @S-Logix

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • +91- 81240 01111

Social List

How to Set The Timers in Contiki-Ng?

Set The Timers In Contiki-Ng

Tutorial for Contiki-Ng Simulator to Set the Timers


   Contiki-NG provides a set of timer libraries that are used both by applications and by the OS itself. The timer libraries contain functionality for checking if a time period has passed, waking up the system from low power mode at scheduled times, and real-time tasks scheduling.

  All the timers build on the clock module, in charge of basic system time:

1. timer: a simple timer, without built-in notification (caller must check if expired). Safe from interrupt.

2. stimer: same as timer, but in seconds and with significantly longer wrapping period. Safe from interrupt.

3. etimer: schedules events to Contiki-NG processes. Unsafe from interrupt.

4. ctimer: schedules calls to a callback function. Unsafe from interrupt.

5. rtimer: real-time task scheduling, with execution from ISR. Safe from interrupt.


File location -> contiki-Ng/os/sys
#include "sys/timer.h"
static struct timer rxtimer;
void init(void) {
  timer_set(&rxtimer, CLOCK_SECOND / 2);
  if(timer_expired(&rxtimer)) {
   /* Timeout */