C Language Development Kit/Functions/Idle

From OptiWiki

Jump to: navigation, search
Description This function sets the reader in a 'sleep' mode. Calling this function while waiting for an action, will reduce the power consumption significantly.
void idle(void);
Arguments None
Returns None
Remarks After calling the idle() function, the reader will halt program execution

until it is awakened by a software interrupt like the reception of data over the serial port, or by a hardware interrupt like a keystroke. When no interrupts are received, the terminal will resume program execution within a maximum of 10 (PHL1300/1700/2700) or 20 milliseconds (OPH100x, DWT7133, OPL97xx, DCL153x) after calling idle(). Using idle() has almost no effect on the scanning performance. One can use this function while waiting for a keystroke, while waiting for reception of data etc.

// The following example demonstrates the use of idle() and the power reduction.
// The example may reduce power consumption by about 2-4 times!
#include "lib.h"
#include <stdio.h>
void main( void )
    unsigned int x;
    while( 1 )
        printf("\fidle loop");
        for( x=0; x < 200; x++)
        printf("\f normal loop");
        for( x=0; x < 10000; x++)

Personal tools