#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File
// Prototype statements for functions found within this file.
interrupt void cpu_timer0_isr(void);
#define LEDS *(int *)0xc0000
#define CTRGR *(int *)0x108000
#define CTRLCDCMDR *(int *)0x108001
#define CTRKEY *(int *)0x108001
#define CTRLCDCR *(int *)0x108002
#define CTRCLKEY *(int *)0x108002
#define CTRLCDLCR *(int *)0x108003
#define CTRLCDRCR *(int *)0x108004
#define CTRLA *(int *)0x108005
#define CTRLR *(int *)0x108007
int i=0,nCount;
unsigned int uLBD;
void main(void)
{
unsigned int uPort8000;
InitSysCtrl();//初始化cpu
DINT;//关中断
InitPieCtrl();//初始化pie寄存器
IER = 0x0000;//禁止所有的中断
IFR = 0x0000;
InitPieVectTable();//初始化pie中断向量表
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
CpuTimer0.RegsAddr = &CpuTimer0Regs;
// Initialize timer period to maximum:
CpuTimer0Regs.PRD.all = 0xffff;
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT):
CpuTimer0Regs.TPR.all = 0;
CpuTimer0Regs.TIM.all = 0;
CpuTimer0Regs.TPRH.all = 0;
// Make sure timer is stopped:
CpuTimer0Regs.TCR.bit.TSS = 1;
CpuTimer0Regs.TCR.bit.SOFT = 1;
CpuTimer0Regs.TCR.bit.FREE = 1;
// Reload all counter register with period value:
CpuTimer0Regs.TCR.bit.TRB = 1;
CpuTimer0Regs.TCR.bit.TIE = 1;
// Reset interrupt counters:
CpuTimer0.InterruptCount = 0;
StartCpuTimer0();//启动定时器0
// Enable CPU INT1 which is connected to CPU-Timer 0:
IER |= M_INT1;
// Enable TINT0 in the PIE: Group 1 interrupt 7
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
CTRGR=0; // 初始化ICETEK-CTR
CTRGR=0x80;
CTRGR=0;
CTRLR=0; // 关闭东西方向的交通灯
CTRLR=0x40; // 关闭南北方向的交通灯
uPort8000=CTRCLKEY;
while ( 1 )
{
}
}
interrupt void cpu_timer0_isr(void)
{ int j,k;
//CpuTimer0.InterruptCount++;
// Acknowledge this interrupt to receive more interrupts from group 1
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
CpuTimer0Regs.TCR.bit.TIF = 1;
CpuTimer0Regs.TCR.bit.TRB = 1;
if ( nCount==0 )
{
LEDS=uLBD;
uLBD++; uLBD%=16;
}
nCount++; nCount%=194;
}
//===========================================================================
// No more.
//========================================
TMS320F2812 郑海波 南京邮电大学 B08020526 (一).定时器 0 的使用 定时器 1.声明定时器中断服务函数。 声明定时器中断服务函数。 声明定时器中断服务函数 如:...
_TMS320F2812_CPU 定时器_信息与通信_工程科技_专业资料。第九讲 TMS320F2812芯片集成外设的开发 (CPU定时器0、GPIOA) TMS320 F2812上的CPU 定时器 F2812器件...
死区定时器周期为 5 //死区定时器 1 使能 //死区定时器预定标因子,死区时钟为 HSPCLK/8 示例程序 2: : 一个产生 PWM 波的样例程序,用于 TMS320F2812 (...
ADC、定时器、 SCI 编程等均以中断方式进行,可提高 CPU 的利用率。 2.4 复位引导 图 2 所示是 TMS320F2812 的片上引导 ROM 空间映射。 其此导程序配置 在...
(代码/数据空间的分配、中断 服务程序的调用、 定时器的使用等) 减小了开发...图3-24 启动CCS对话框 此时CCS已经被设置成Simulator方式(软件仿真TMS320F2812...
TMS320F2812的PWM程序中文解释_信息与通信_工程科技_专业资料。TMS320F2812的PWM...// 设置事件管理器的定时器(TIMER1, TIMER2, TIMER3 and TIMER4) // 来产...
ADC、定时器、SCI 编程等均以中断方式进行,可提高 CPU 的利用率。 2.4 复位引导 图 2 所示是 TMS320F2812 的片上引导 ROM 空间映射。 其此导程序配置 在图...
(15:0) CPU定时器0 CPU定时器2(用于RTOS) CPU定时器1(用于RTOS) GPIO MUX...⑷执行中断服务子程序 12 3.2 PIE中断扩展 ? TMS320F2812片内含有丰富的外设...
TMS320F2812简介_信息与通信_工程科技_专业资料。Tms320F2812 数字信号处理器简介 (Ver. A)主讲:刘宇 Email: liuyu_nx@163.com 2007年04月14日 本讲座主要内...
TMS320F2812 处理器特性 1.高性能静态 CMOS(Static CMOS)技术 ? 150MHz(时钟...防止 ROM 中的程序被盗 11.3 个 32 位的 CPU 定时器 ? 12.马达控制外围...
闽公网安备 35021102001881号 
热门文档