📄 example_280xcputimer.c
字号:
#include "DSP280x_Device.h" // DSP280x Headerfile Include File
#include "DSP280x_Examples.h" // DSP280x Examples Include File
interrupt void cpu_timer0_isr(void);
const Uint16 LedCode[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E,0xFF};
const Uint16 Light[] ={0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F };
void SendData(Uint16 num,Uint16 data);
Uint16 LedCount = 0;
Uint16 LedCount1 = 0;
Uint16 flag =0;
void main(void)
{
InitSysCtrl();
InitGpio();
SetCs(1);
SetCs(0);
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TINT0 = &cpu_timer0_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
InitCpuTimers(); // For this example, only initialize the Cpu Timers
ConfigCpuTimer(&CpuTimer0, 100, 100000);
IER |= M_INT1;
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
// Step 6. IDLE loop. Just sit and loop forever (optional):
SendData(1,0xB0);
SendData(0,0xDF);
StartCpuTimer0();
for (; ;);
}
interrupt void cpu_timer0_isr(void)
{
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
SendData(1,LedCode[LedCount]);
SendData(0,Light[LedCount1]);
LedCount++;
LedCount1++;
if (LedCount>15) LedCount=0;
if (LedCount1>7) LedCount1 = 0;
}
//===========================================================================
// No more.
//===========================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -