中断系统程序设计
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
#include"DSP2833x_Device.h"
#include"DSP2833x_Examples.h"
#define LED1_ON GpioDataRegs.GPASET.bit.GPIO0=1
#define LED1_OFF GpioDataRegs.GPACLEAR.bit.GPIO0=1 #define LED2_ON GpioDataRegs.GPASET.bit.GPIO1=1
#define LED2_OFF GpioDataRegs.GPACLEAR.bit.GPIO1=1 #define LED3_ON GpioDataRegs.GPASET.bit.GPIO2=1
#define LED3_OFF GpioDataRegs.GPACLEAR.bit.GPIO2=1 #define LED4_ON GpioDataRegs.GPASET.bit.GPIO3=1
#define LED4_OFF GpioDataRegs.GPACLEAR.bit.GPIO3=1 #define LED5_ON GpioDataRegs.GPASET.bit.GPIO4=1
#define LED5_OFF GpioDataRegs.GPACLEAR.bit.GPIO4=1 #define LED6_ON GpioDataRegs.GPASET.bit.GPIO5=1
#define LED6_OFF GpioDataRegs.GPACLEAR.bit.GPIO5=1 #define LED7_ON GpioDataRegs.GPBSET.bit.GPIO51=1 #define LED7_OFF GpioDataRegs.GPBCLEAR.bit.GPIO51=1 #define LED8_ON GpioDataRegs.GPBSET.bit.GPIO50=1 #define LED8_OFF GpioDataRegs.GPBCLEAR.bit.GPIO50=1 interrupt void ISRExint3(void);
interrupt void ISRExint4(void);
interrupt void ISRExint5(void);
interrupt void ISRExint6(void);
void configtestled(void);
Uint16sign ;
void main(void)
{ InitSysCtrl();
InitXintf16Gpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.XINT3 = &ISRExint3;
PieVectTable.XINT4 = &ISRExint4;
PieVectTable.XINT5 = &ISRExint5;
PieVectTable.XINT6 = &ISRExint6;
EDIS;
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER12.bit.INTx1= 1;
PieCtrlRegs.PIEIER12.bit.INTx2= 1;
PieCtrlRegs.PIEIER12.bit.INTx3= 1;
PieCtrlRegs.PIEIER12.bit.INTx4= 1;
IER |= M_INT12;
EINT;
ERTM;
configtestled();
sign = 0;
while(1)
{
if(sign==0)
{ LED1_OFF;
LED2_OFF;
LED3_OFF;
LED4_OFF;
LED5_OFF;
LED6_OFF;
LED7_OFF;
LED8_OFF;
DELAY_US(50000);
LED1_ON;
DELAY_US(50000);
LED2_ON;
DELAY_US(50000);
LED3_ON;
DELAY_US(50000);
LED4_ON;
DELAY_US(50000);
LED5_ON;
DELAY_US(50000);
LED6_ON;
DELAY_US(50000);
LED7_ON;
DELAY_US(50000);
LED8_ON;
DELAY_US(50000); }
if(sign==3)
{
LED1_OFF;
LED2_OFF;
LED3_OFF;
LED4_OFF;
LED5_OFF;
LED6_OFF;
LED7_OFF;
LED8_OFF;
DELAY_US(50000);
LED1_ON;
LED2_ON;
DELAY_US(50000);
LED3_ON;
LED4_ON;
DELAY_US(50000);
LED5_ON;
LED6_ON;
DELAY_US(50000);
LED7_ON;
LED8_ON;
DELAY_US(50000); } if(sign==4)
{ LED1_ON;
LED2_ON;
LED3_ON;
LED4_ON;
LED5_ON;
LED6_ON;
LED7_ON;
LED8_ON;
DELAY_US(50000);
LED1_OFF;