F280049C 一共有三个定时器,timer 0.1.2
涉及到的寄存器
TIM 是计数器当前值 ,PRD是重载值,
F280049C这个器件比较新,中文的资料很少,可以找一些F28335的资料来看看,功能外设基本类似。看英文资料还是有点压力
资料来源是南京一家公司做的一个C2000助手 网盘地址是:下载地址:http://pan.baidu.com/s/1i4FfHRJ 大家可以去看看
用库函数还是比较简单的
代码:https://download.csdn.net/download/Rocky_Zou/12201722
#include "F28x_Project.h"
#include "device.h"
#include "math.h"
__interrupt void cpuTimer2ISR(void);
void main(void)
{
Device_init();
Device_initGPIO();
Interrupt_initModule();
Interrupt_initVectorTable();
bsp_LedInit();
InitPieVectTable();
EALLOW;
PieVectTable.TIMER2_INT = &cpuTimer2ISR;
EDIS;
InitCpuTimers();
ConfigCpuTimer(&CpuTimer2, 100, 100000);
CpuTimer2Regs.TCR.all = 0x4000;
IER |= M_INT14;
EINT;
ERTM;
for(;;)
{
bsp_LedCtrl(LED0,Toggle);
DEVICE_DELAY_US(100000);
bsp_LedCtrl(LED0,Toggle);
DEVICE_DELAY_US(100000);
}
}
__interrupt void cpuTimer2ISR(void)
{
//
// The CPU acknowledges the interrupt
//
CpuTimer2.InterruptCount++;
bsp_LedCtrl(LED1,Toggle);
}