筆記:(三)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-----------------------------------*/
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/264528.html
標籤:其他
上一篇:長江雨課堂
