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

📄 timer_func.c

📁 ST公司的upsd34XX评估板固定源程序
💻 C
字号:
// A collection of general functions for WSi evaluation hardware. 
//
// These functions must reside in common FLASH so that they may be 
// executed from any page. 


#include "upsd_cfg.h"

#include "general.h"
#include "timer.h"

//Timer functions are ready for 1ms interval

#define	TIMER0_SCALE TIMER0_PERIOD/1000	

int counter;

/*------------------------------------------------------------------------------
This function extend Timer0 operation in every timer0 interrupt
------------------------------------------------------------------------------*/
void do_timer0(void) {

	// put your extended functions for timer0 interrupt

    counter++;
}

/*------------------------------------------------------------------------------
//  Following are a collection of timer routines.
------------------------------------------------------------------------------*/
void delay_ms(count)
uint count;         
	{               
	if(count <= TIMER0_SCALE)
           	timer0_wait(count);
        else
        	{
		count /= TIMER0_SCALE;
       		timer0_wait(count);
		}
 	}
/*
void delay_1sec(void)
	{
	timer0_wait(1000);
	}


void delay_2sec(void)
	{
       timer0_wait(200);
	}

void delay_10sec(void)
	{
	timer0_wait(1000);
	}

void delay_0_5sec(void)
	{
	timer0_wait(50);
   }

void delay_0_1sec(void)
	{
	timer0_wait(10);
   }

void delay_46us(void)		// Delay of 44.8 usec. measured   
	{
	delay_14us();
	delay_14us();
	delay_14us();
	}

void delay_14us(void)       // Delay of 14.8us w/16Mhz 8031 measured 
	 {
 	uchar a;
	uchar b;
	data uint c;
    	a=1;
	b=2;
	c=a+b;
        a=3;
	b=c;
        c=4;
 	}
*/

⌨️ 快捷键说明

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