没有一起用过的经验 网上找了一些例子程序
发现用了之后 还是只有定时器0在工作 ,定时器2的中断根本没进去过 想知道原因
附上自己的程序:
#include "DSP281x_Device.h"
#include "example_nonBIOS.h"
#include "main.h"
#define StartCpuTimer0() CpuTimer0Regs.TCR.bit.TSS = 0
#define StartCpuTimer2() CpuTimer2Regs.TCR.bit.TSS = 0
void User_Init(void);
interrupt void cpu_timer0_isr(void);
interrupt void cpu_timer2_isr(void);
void main(void)
{
/*** CPU Initialization ***/
InitSysCtrl(); //Initialize the CPU (FILE: SysCtrl.c)
DINT;
IER = 0x0000; // Disable CPU interrupts
IFR = 0x0000; // Clear all CPU interrupt flags
InitXintf(); //Initialize the external memory interface (FILE: Xintf.c)
//InitGpio(); // Initialize the shared GPIO pins (FILE: Gpio.c)
InitPieCtrl(); // Initialize and enable the PIE (FILE: PieCtrl.c)
InitEv(); // Initialize the EV(FILE: Ev.c)--And initialize the Timer1
InitCpuTimers();
// Initialize the time (FILE: DSP281x_CpuTimers.c)
//FFT();
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TINT0 = &cpu_timer0_isr;//timer0中断服务子程序重定位
PieVectTable.TINT2 = &cpu_timer2_isr;//timer0中断服务子程序重定位
EDIS; // This is needed to disable write to EALLOW protected registers
IER |=(M_INT1|M_INT14); // EV Interrupt
IFR &= 0x0000; //Clear all interrupt flag
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;// Enable TINT0 in the PIE: Group 1 interrupt 7
//SetDBGIER(IER); // Configure the DBGIER for realtime debug
EINT; // Enable global interrupts and realtime debug
ERTM;
//asm(" CLRC INTM, DBGM");
StartCpuTimer0();
StartCpuTimer2();
while(1)
{}
}
interrupt void cpu_timer0_isr(void)
{
Count_AD++;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
interrupt void cpu_timer2_isr(void)
{
COUNT++;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2;
}
|