笔记:合泰单片机BH66F2652开发(三)INIT

笔记:(三)INIT外部中断驱动

#include "include.h"

/*******************************************************************************
 * fuction	IRONInit	
 * brief	
 * param	无                                                             
 * return	无
 *******************************************************************************/
void IRONInit(void)
{
    
    
	_pas17 = 0;
	_pas16 = 0;
	gpioInput(IR_ON);		//PA7
	gpioPullUpEnable(IR_ON);//PA7

 	_integ = 0b00001000;//0b00000100	
	_int1e = 1;   //外部中断1中断使能
	_int1f = 0;   //清外部中断1标志位	
	_emi = 1;     //使能总中断
}  
/*******************************************************************************
 * fuction	INT1ISR	
 * brief	INT1中断函数
 * param	
 * return	无
 *******************************************************************************/
DEFINE_ISR(INT1ISR,INT1VECTOR)
{
    
    
	DynamicBlackWhiteCnt++;	
	if(DynamicBlackWhiteCnt == 1)
	{
    
    
		SysCntStart = SysCnt;	
	}
	SysCntEnd = SysCnt;	
	_int1f = 0;	
}
#ifndef _IR_H
#define _IR_H

#include "BH66F2652.h"


#define IR_ON		PA7 //计数 外部中断1
#define INT1VECTOR 	0x08

extern void IRONInit(void);

#endif
/*--------------------------------END THE FILE-----------------------------------*/

猜你喜欢

转载自blog.csdn.net/FutureStudio1994/article/details/114127969