Other Parts Discussed in Thread: C2000WARE
Dear Experts,
I am trying to initialize timer and system initialisation. I had blinked a GPIO on and Off. However, I couldn't do accomplish the same task with the timer and interrupts and there are no errors though. Kindly see the issues in the code attached. In addition to that, I would like to know whether the program initalised the microcontroller at 200MHz.
#include "F28x_Project.h"
interrupt void timer_ovf_isr(void);
extern void InitSysCtrl(void);
void TimerInit();
void GpioInit();
int a =0;
void main(void)
{
InitSysCtrl();
TimerInit();
GpioInit();
DINT;
InitPieCtrl();
InitPieVectTable();
EALLOW;
EALLOW;
PieVectTable.TIMER0_INT = &timer_ovf_isr;
EDIS;
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
IER |= 0x0001;
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
CpuTimer0Regs.TCR.bit.TSS = 0;
while(1)
{
//idle
}
}
void GpioInit(void)
{
GpioCtrlRegs.GPAGMUX1.bit.GPIO13 = 0;
GpioCtrlRegs.GPADIR.bit.GPIO13 = 1;
GpioCtrlRegs.GPADIR.bit.GPIO12 = 1;
}
void TimerInit(void)
{
CpuTimer0Regs.PRD.bit.LSW = 0x02FF;
CpuTimer0Regs.PRD.bit.MSW = 0x002F;
CpuTimer0Regs.TPR.bit.TDDR = 0x001F;
CpuTimer0Regs.TCR.bit.TIE = 1;
CpuTimer0Regs.TCR.bit.TRB = 0;
CpuTimer0Regs.TCR.bit.TSS = 1;
CpuTimer0Regs.TCR.bit.FREE = 0;
}
void timer_ovf_isr(void)
{
GpioDataRegs.GPATOGGLE.bit.GPIO13 = 1;
GpioDataRegs.GPATOGGLE.bit.GPIO12 = 1;
CpuTimer0Regs.TCR.bit.TIF = 1;
PieCtrlRegs.PIEIFR1.bit.INTx7 = 0;
PieCtrlRegs.PIEACK.all = 0x0001;
}