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

📄 dsp281x_xintrupt.c

📁 代码用于测试dsp2812的硬件功能
💻 C
字号:
//###########################################################################
//
// FILE:   DSP281x_XIntrupt.c
// TITLE:  DSP28 External Interrupt Initialization & Support Functions.
// WRITER: ZHANG X.L.;
//
//###########################################################################
 
#include "DSP281x_Device.h"     // DSP281x Headerfile Include File
#include "DSP281x_Examples.h"   // DSP281x Examples Include File

// Sensor state variables;
ULTRAREDSWITCH UltraredSwitch = 0x0000;
STROKESWITCH StrokeSwitch = 0x0000;
//extern Uint16 MDir;

interrupt void FPGA_XINT1ISR(void);
interrupt void FPGA_XINT2ISR(void);

//---------------------------------------------------------------------------
// InitXIntrupt: 
// This function initializes external interrupts to a known state.
//---------------------------------------------------------------------------
void InitXIntrupt(void)
{
	XIntruptRegs.XINT1CR.bit.POLARITY = 1;	// Interrupt triggered on rising down edge;
	XIntruptRegs.XINT1CR.bit.ENABLE = 1;	// Enable the XINT1;
	XIntruptRegs.XINT2CR.bit.POLARITY = 1;
	XIntruptRegs.XINT2CR.bit.ENABLE = 1;

	// Remap PIE entry for XINT1 AND XINT2;
	EALLOW;
	PieVectTable.XINT1 = &FPGA_XINT1ISR;
	PieVectTable.XINT2 = &FPGA_XINT2ISR;
	EDIS;
}

//---------------------------------------------------------------------------
// XINT1 interrupt service routine;
//--------------------------------------------------------------------------
interrupt void FPGA_XINT1ISR(void)
{
	StrokeSwitch = ReadBus(FStrSwAddr);

	// Acknowledge this interrupt to receive more interrupts from group 1;
	PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

	//SCITXD(0x7C);	//$

	// Next two lines for debug only to halt the processor here
	// Remove after inserting ISR Code
	// ESTOP0;
	// for(;;);
}

//--------------------------------------------------------------------------
// XINT2 interrupt service routine;
//--------------------------------------------------------------------------
interrupt void FPGA_XINT2ISR(void)
{
	UltraredSwitch = ReadBus(FUredSwAddr);

	// Acknowledge this interrupt to receive more interrupt from group 1;
	PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

	//SCITXD(0x7D);	//$

	// Next two lines for debug only to halt the processor here
	// Remove after inserting ISR Code
	// ESTOP0;
	// for(;;);
}
//===========================================================================
// No more.
//===========================================================================

⌨️ 快捷键说明

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