#include"DSP2833x_Device.h" // DSP2833x HeaderfileInclude File
#include "DSP2833x_Examples.h" // DSP2833x ExamplesInclude File
//端口宏定义
#define key5 GpioDataRegs.GPADAT.bit.GPIO4
#define key6 GpioDataRegs.GPADAT.bit.GPIO5
#define key7 GpioDataRegs.GPADAT.bit.GPIO6
#define key8 GpioDataRegs.GPADAT.bit.GPIO7
//定义全局变量
unsigned short flag1=0,flag2=0,flag3=0,flag4=0;
//声明函数
void scan_key(void);
void manage_key1(void);
void manage_key2(void);
void manage_key3(void);
void manage_key4(void);
void Gpio_select(void);
//主函数
void main(void)
{
InitSysCtrl();
DINT;
Gpio_select() ;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
InitPieVectTable();
InitXintf();
key5=0;
key6=0;
key7=0;
key8=0;
while(1)
{
if((key5==1)|(key6==1)|(key7==1)|(key8==1))
scan_key();
}
}
//按键查询
void scan_key()
{
unsigned int i;
for(i=0;i<10000;i++){};//去抖动