DELAY

This library provides the functions to generate the required delays. Basically it does the looping for the specified count to generate the delay. If the compiler provides the inbuilt delay libraries(like AVR), then this library uses internally those functions.


DELAY_us

{{#Widget:LibTable}}
Defination void DELAY_us(uint16_t us_count)
Input Arguments uint16_t: Count to generate the required delay in us
Return Value none
Description This function is used generate delay in us. It generates a delay of 10us for each count.
If 5000 is passed as the argument then it generates a delay of 50ms.
Usage DELAY_us(10); generates 10us delay

DELAY_ms

{{#Widget:LibTable}}
Defination void DELAY_ms(uint16_t ms_count)
Input Arguments uint16_t: required delay
Return Value none
Description This function is used generate delay in ms. It generates a delay of 1ms for each count.
If 1000 is passed as the argument then it generates delay of 1000ms(1sec)
Usage DELAY_ms(500); generates 500ms delay

DELAY_sec

{{#Widget:LibTable}}
Defination void DELAY_sec(uint16_t sec_count)
Input Arguments uint16_t.
Return Value none
Description This function is used generate delay in sec .It generates a delay of 1sec for each count,if 10 is passed as the argument then it generates delay of 10sec.
Usage DELAY_us(10); generates 10sec delay

user guide

/* Program to blink the LEDs using delay routines*/

#include<reg52.h>
#include "delay.h"   //User defined library which contains the delay routines
 
 
 
int  main()
{
 
 
	while(1)
	{
		PO = 0xff;      /* Turn ON the LEDs */
		DELAY_us(10);   /* Generate the delay of 1sec+10ms+10us */
		DELAY_ms(10);
		DELAY_sec(1);
 
		P0 = 0x00;     /* Turn OFF the LEDs */
		DELAY_us(10);  /* Generate the delay of 1sec+10ms+10us */
		DELAY_ms(10);
		DELAY_sec(1);
 
	}
 
	return 0;
}