Pond Electronics - Home of the µFlash876 & µFlash876B embedded controllers, µStack & µConnect Bus.

Delay Module

This module includes a single function which provides soft delay specified in µSeconds. delay.h also includes a number of predefined macros to facilitate representing long delays.

#define uS *1L
#define mS *1000L
#define Sec *1000000L

When using these it is important to include a space after the number, for example:

delay(20 Sec);         // a soft delay of 20 seconds   
delay(20Sec);          // is a syntax error

 

delay

void delay(LONG x);

A soft delay of between 1 and 4294967295 µS (approx 71 minutes). The delay does not include the overhead of the function call. Note also that since this delay is implemented in software it does not include any time spent in interrupt service routines which are active during the delay.

Example - A flashing LED program

#include <ucore.h>        // include all ucore modules   

int main(void)
    {
    while(1)
        {
        led_off();
        delay(500 mS);
        led_on();
        delay(500 mS);
        }
    }


Home | Products | Technical Info | How to Order | Contact Us | Links