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

📄 init_timer2.c.bak

📁 diPIC 系列程序
💻 BAK
字号:



#include "p33FJ256GP710.h"




void Init_timer2(void)
{
	
	T2CON = 0x0000;
	
	PR2 = 0x8000;
	
	IFS0bits.T2IF = 0;
	
	IPC0bits.T2IP = 5;
	
	
	
	T2CON = 0x8010;
	// 1000 0000 0001 0000
	/*
	Bit15 T2O "1" start timer
	Bit14 undefine
	Bit13 0 = Continue module operation in Idle mode
	Bit12 undefine 
	Bit11 undefine
	Bit10 undefine
	Bit09 undefine
	Bit08 undefine
	Bit07 undefine
	Bit06 TGATE 0
	Bit05 0
	Bit04 1 1:8 
	Bit03 T32 1 = Timerx and Timery form a single 32-bit timer; 0 = Timerx and Timery act as two 16-bit timers
	Bit02 undefine
	Bit01 TCS: Timerx Clock Source Select bit
	Bit00 undefine
	*/
	
	
	
}


void __attribute__((__interrupt__)) _T2Interrupt( void )
{
	int count;
	/* Simple I am here indicator */
	if ( count++ == 1500 ) {
		__builtin_btg( (unsigned int *)&LATA, 2 );
		count = 0;
	}



	/* reset Timer 2 interrupt flag */
 	IFS0bits.T2IF = 0;
}







⌨️ 快捷键说明

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