(2 intermediate revisions by one other user not shown)
Line 8: Line 8:
  
 
==DELAY_us==
 
==DELAY_us==
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
Line 26: Line 26:
  
 
==DELAY_ms==
 
==DELAY_ms==
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
 
|Defination ||  void DELAY_ms(uint16_t ms_count)
 
|Defination ||  void DELAY_ms(uint16_t ms_count)
 
|-
 
|-
| Input Arguments || uint16_t: required delay
+
| Input Arguments || uint16_t: Count to generate the required delay in ms
 
|-
 
|-
 
| Return Value|| none
 
| Return Value|| none
Line 44: Line 44:
  
 
==DELAY_sec==
 
==DELAY_sec==
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
Line 64: Line 64:
 
/* Program to blink the LEDs using delay routines*/
 
/* Program to blink the LEDs using delay routines*/
  
#include<reg52.h>
+
#include<reg51.h>
 
#include "delay.h"  //User defined library which contains the delay routines
 
#include "delay.h"  //User defined library which contains the delay routines
  

Latest revision as of 08:50, 10 January 2015

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: Count to generate the required delay in ms
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: Count to generate the delay in sec
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_sec(10); generates 10sec delay


user guide

/* Program to blink the LEDs using delay routines*/
 
#include<reg51.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;
}