(DELAY)
 
(18 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
Basically it does the looping for the specified  count to generate the delay.
 
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.
 
If the compiler provides the inbuilt delay libraries(like AVR), then this library uses internally those functions.
 +
  
  
 
==DELAY_us==
 
==DELAY_us==
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination ||  
+
|Defination || void DELAY_us(uint16_t us_count)
 
|-
 
|-
| Input Arguments ||
+
| Input Arguments ||uint16_t: Count to generate the required delay in us
 
|-
 
|-
| Return Value||  
+
| Return Value|| none
 
|-
 
|-
| Description ||
+
| Description ||This function is used generate delay in us. It generates a delay of 10us for each count. <br />If 5000 is passed as the argument then it generates a delay of 50ms.
 
|-
 
|-
| Usage ||  
+
| Usage || DELAY_us(10);  generates 10us delay
 
|}
 
|}
  
Line 25: Line 26:
  
 
==DELAY_ms==
 
==DELAY_ms==
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination ||  
+
|Defination || void DELAY_ms(uint16_t ms_count)
 
|-
 
|-
| Input Arguments ||  
+
| Input Arguments || uint16_t: Count to generate the required delay in ms
 
|-
 
|-
| Return Value||  
+
| Return Value|| none
 
|-
 
|-
| Description ||  
+
| 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 || DELAY_ms(500);  generates 500ms delay
 
|}
 
|}
  
Line 43: Line 44:
  
 
==DELAY_sec==
 
==DELAY_sec==
{| class="wikitable"  style="colspan:1; background-color:#4682B4;"
+
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
 
|Defination ||  void DELAY_sec(uint16_t sec_count)
 
|Defination ||  void DELAY_sec(uint16_t sec_count)
 
|-
 
|-
| Input Arguments ||  uint16_t.
+
| Input Arguments ||  uint16_t: Count to generate the delay in sec
 
|-
 
|-
 
| Return Value||  none
 
| Return Value||  none
 
|-
 
|-
| Description ||  This function is used generate delay in sec .It generates a delay of 1sec for each  
+
| 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.  
|-count,if 10 is passed as the argument then it generates delay of 10sec.
+
|-
| Usage ||
+
| Usage ||DELAY_sec(10);  generates 10sec delay
 
|}
 
|}
 
  
  
  
 
==user guide==
 
==user guide==
 +
<syntaxhighlight>
 +
/* 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;
 +
}
 +
</syntaxhighlight>

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