⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delay.c

📁 Mplab C30编译器
💻 C
字号:
#include "xlcd.h"
#include "delay.h"

#ifdef _RD10

/******************************************************************************
    This file provides the delay routines required XLCD operation.

The following are the delay routines provided: 
    1. DelayEPulseWidth - Delay for width of the E pulse
    2. DelayXLCD    - Delay for atleast 5msec 
    3. Delay600nsXLCD - Delay for 100Tcy
    4. DelayPORXLCD - Delay for atleast 15msec

The loop counts used in these routines needs to be changed based on the 
exact clock frequency.
******************************************************************************/



void DelayEPulseWidth(void)   	/* provides delay for 18Tcy */
{
	/* This is the width of the E signal		*/
	/* required by the LCD controlller			*/
	
	int i;
	for(i=0;i<18;i++)
		asm("clrwdt");
}

void DelayPORXLCD(void) 	/* provides delay for atleast 15msec */
{
    /* Give a delay of atleast 15 msec after power up	*/
   
    
   long i;
    for(i=0;i < 2000000;i++)
        asm("clrwdt");
}

void DelayXLCD(void)  		/* provides delay for atleast 5msec */
{
  long i;
    for(i=0;i < 200000;i++)
        asm("clrwdt");
        }

void Delay600nsXLCD(void)		/* provides delay for 600ns */
{
	/* This delay is required during the read operation	*/
	
    int i;
    for(i=0;i<10000;i++)
        asm("clrwdt");
}

//For 33F and 24H devices

void Delay200usXLCD(void)	/* provides delay for 200uS */
{
    int i;
    for(i=0;i<8000;i++)
        asm("clrwdt");
}



#else
#warning "Does not build on this target"
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -