tms320f2802头文件及程序

上传人:第*** 文档编号:30619949 上传时间:2018-01-31 格式:DOC 页数:71 大小:139.50KB
返回 下载 相关 举报
tms320f2802头文件及程序_第1页
第1页 / 共71页
tms320f2802头文件及程序_第2页
第2页 / 共71页
tms320f2802头文件及程序_第3页
第3页 / 共71页
tms320f2802头文件及程序_第4页
第4页 / 共71页
tms320f2802头文件及程序_第5页
第5页 / 共71页
点击查看更多>>
资源描述

《tms320f2802头文件及程序》由会员分享,可在线阅读,更多相关《tms320f2802头文件及程序(71页珍藏版)》请在金锄头文库上搜索。

1、/ TI File $Revision: /main/1 $/ Checkin $Date: December 1, 2004 12:31:30 $/#/ FILE: DSP280x_CpuTimers.h/ TITLE: DSP280x CPU 32-bit Timers Register Definitions./ NOTES: CpuTimer1 and CpuTimer2 are reserved for use with DSP BIOS and/ other realtime operating systems. / Do not use these two timers in y

2、our application if you ever plan/ on integrating DSP-BIOS or another realtime OS. / For this reason, the code to manipulate these two timers is/ commented out and not used in these examples./#/ $TI Release: DSP280x, DSP2801x Header Files V1.41 $/ $Release Date: August 7th, 2006 $/#ifndef DSP280x_CPU

3、_TIMERS_H#define DSP280x_CPU_TIMERS_H#ifdef _cplusplusextern C #endif/-/ CPU Timer Register Bit Definitions:/ TCR: Control register bit definitions:struct TCR_BITS / bits descriptionUint16 rsvd1:4; / 3:0 reservedUint16 TSS:1; / 4 Timer Start/StopUint16 TRB:1; / 5 Timer reloadUint16 rsvd2:4; / 9:6 re

4、servedUint16 SOFT:1; / 10 Emulation modesUint16 FREE:1; / 11Uint16 rsvd3:2; / 12:13 reservedUint16 TIE:1; / 14 Output enableUint16 TIF:1; / 15 Interrupt flag; union TCR_REG Uint16 all;struct TCR_BITS bit;/ TPR: Pre-scale low bit definitions:struct TPR_BITS / bits descriptionUint16 TDDR:8; / 7:0 Divi

5、de-down lowUint16 PSC:8; / 15:8 Prescale counter low;union TPR_REG Uint16 all;struct TPR_BITS bit;/ TPRH: Pre-scale high bit definitions:struct TPRH_BITS / bits descriptionUint16 TDDRH:8; / 7:0 Divide-down highUint16 PSCH:8; / 15:8 Prescale counter high;union TPRH_REG Uint16 all;struct TPRH_BITS bit

6、;/ TIM, TIMH: Timer register definitions:struct TIM_REG Uint16 LSW;Uint16 MSW;union TIM_GROUP Uint32 all;struct TIM_REG half;/ PRD, PRDH: Period register definitions:struct PRD_REG Uint16 LSW; Uint16 MSW;union PRD_GROUP Uint32 all;struct PRD_REG half;/-/ CPU Timer Register File:/struct CPUTIMER_REGS

7、 union TIM_GROUP TIM; / Timer counter registerunion PRD_GROUP PRD; / Period registerunion TCR_REG TCR; / Timer control registerUint16 rsvd1; / reservedunion TPR_REG TPR; / Timer pre-scale lowunion TPRH_REG TPRH; / Timer pre-scale high;/-/ CPU Timer Support Variables:/struct CPUTIMER_VARS volatile st

8、ruct CPUTIMER_REGS *RegsAddr;Uint32 InterruptCount;float CPUFreqInMHz;float PeriodInUSec;/-/ Function prototypes and external definitions:/void InitCpuTimers(void);void ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period);extern volatile struct CPUTIMER_REGS CpuTimer0Regs;extern str

9、uct CPUTIMER_VARS CpuTimer0;/ CpuTimer 1 and CpuTimer2 are reserved for DSP BIOS & other RTOS/extern volatile struct CPUTIMER_REGS CpuTimer1Regs;/extern volatile struct CPUTIMER_REGS CpuTimer2Regs;/extern struct CPUTIMER_VARS CpuTimer1;/extern struct CPUTIMER_VARS CpuTimer2;/-/ Usefull Timer Operati

10、ons:/ Start Timer:#define StartCpuTimer0() CpuTimer0Regs.TCR.bit.TSS = 0/ Stop Timer:#define StopCpuTimer0() CpuTimer0Regs.TCR.bit.TSS = 1/ Reload Timer With period Value:#define ReloadCpuTimer0() CpuTimer0Regs.TCR.bit.TRB = 1/ Read 32-Bit Timer Value:#define ReadCpuTimer0Counter() CpuTimer0Regs.TIM

11、.all/ Read 32-Bit Period Value:#define ReadCpuTimer0Period() CpuTimer0Regs.PRD.all/ CpuTimer 1 and CpuTimer2 are reserved for DSP BIOS & other RTOS/ Do not use these two timers if you ever plan on integrating / DSP-BIOS or another realtime OS. / For this reason, the code to manipulate these two time

12、rs is/ commented out and not used in these examples./ Start Timer:/#define StartCpuTimer1() CpuTimer1Regs.TCR.bit.TSS = 0/#define StartCpuTimer2() CpuTimer2Regs.TCR.bit.TSS = 0/ Stop Timer:/#define StopCpuTimer1() CpuTimer1Regs.TCR.bit.TSS = 1/#define StopCpuTimer2() CpuTimer2Regs.TCR.bit.TSS = 1/ R

13、eload Timer With period Value:/#define ReloadCpuTimer1() CpuTimer1Regs.TCR.bit.TRB = 1/#define ReloadCpuTimer2() CpuTimer2Regs.TCR.bit.TRB = 1/ Read 32-Bit Timer Value:/#define ReadCpuTimer1Counter() CpuTimer1Regs.TIM.all/#define ReadCpuTimer2Counter() CpuTimer2Regs.TIM.all/ Read 32-Bit Period Value:/#

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 建筑/环境 > 工程造价

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号