C Language Development Kit/Functions/Delay

From OptiWiki

Jump to: navigation, search
Description This function waits for a time specified by the argument time. The time is specified in steps of 20 milliseconds. For example, time = 50 will cause a delay of 20*50 = 1000 milliseconds.
Syntax
void delay(int time);
Arguments
int time
The time is specified in steps of 20 milliseconds.
Returns None
Remarks This function automatically calls the idle() function in order to reduce the power consumption.
Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
 
    while( 1 )
    {
        printf("Hello world.");
        delay( 100 );    // show the message on the screen for 2 seconds 
        printf("\f");
        delay( 100 );
    }
}


Views
Personal tools