Line 34: Line 34:
 
| Return Value|| none
 
| 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)
+
| Description ||This function is used generate delay in ms. It generates a delay of 1ms for each count.
 +
                  </br>If 1000 is passed as the argument then it generates delay of 1000ms(1sec)
 
|-
 
|-
 
| Usage ||  
 
| Usage ||  

Revision as of 17:40, 25 December 2014

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
Input Arguments
Return Value
Description
Usage



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.
                 </br>If 1000 is passed as the argument then it generates delay of 1000ms(1sec)
Usage

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

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;
}