gk_timer2.c

来自「工程模板 使用非常方便适用初学者 敬请下载」· C语言 代码 · 共 48 行

C
48
字号
/*------------------------------------------------------------------------------
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 + =
减小字号Ctrl + -
显示快捷键?