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

📄 gk_timer2.c

📁 工程模板 使用非常方便适用初学者 敬请下载
💻 C
字号:
/*------------------------------------------------------------------------------
uPSD_TIMER.C
------------------------------------------------------------------------------*/

//#pragma CODE					// include assembler listing in .lst file

#include ".\include\reg52.h"
#include ".\include\ld_timer2.h"
#include ".\include\ld_extern_var.h"

#define TIMER2_INTERVAL		0xF8CC		// set timer T0 for 1ms tick

					
/*------------------------------------------------------------------------------
			  Local Variable Declarations
------------------------------------------------------------------------------*/

//static unsigned int timer0_tick;

/*------------------------------------------------------------------------------
static void timer0_isr (void);

This function is an interrupt service routine for TIMER 0.  It should never
be called by a C or assembly function.  It will be executed automatically
when TIMER 0 overflows.
------------------------------------------------------------------------------*/

static void gk_timer2_isr (void) interrupt 5 using 3
{

	TL2 = (TIMER2_INTERVAL & 0x00FF);		// set LSB timeout
	TH2 = (TIMER2_INTERVAL >> 8);			// set MSB timeout
	

}

/*------------------------------------------------------------------------------
void timer0_initialize (void);

This function enables TIMER 0.  TIMER 0 will generate a synchronous interrupt
once every 100Hz (10mS).
------------------------------------------------------------------------------*/
void gk_timer2_initialize (void)		// Enable TMR0 for 10mS interrupts
{

}

⌨️ 快捷键说明

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