init_timer3.c

来自「diPIC 系列程序」· C语言 代码 · 共 57 行

C
57
字号


#include "p33FJ256GP710.h"





void Init_timer3(void)
{
	
	T3CON = 0x0000;
	
	PR3 = 0xDFFF;
	
	IFS0bits.T3IF = 0;
	
	IPC2bits.T3IP = 6;
	
	IEC0bits.T3IE = 1;
	
	T3CON = 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__)) _T3Interrupt( void )
{

	__builtin_btg( (unsigned int *)&LATA, 3 );




	/* reset Timer 3 interrupt flag */
 	IFS0bits.T3IF = 0;
}

⌨️ 快捷键说明

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