




免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
#include DSP281x_Device.h / DSP281x Headerfile Include File#include DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this errupt void XINT2_isr(void);/ 子程序接口void Delay(unsigned int nDelay);/ 延时子程序/ 定义指示灯寄存器地址和寄存器类型#define LBDS (*(unsigned int *)0xc0000)#define XINT2CR (*(unsigned int *)0x7071)#define XNMICR (*(unsigned int *)0x7077)#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 *)0x108007int i=0,nCount,a=0;unsigned int uLBD;void main(void) unsigned int uPort8000;/ This example function is found in the DSP281x_SysCtrl.c file. uLBD=nCount=0; InitSysCtrl();/初始化cpu DINT;/关中断 InitPieCtrl();/初始化pie寄存器 IER = 0x0000;/禁止所有的中断 IFR = 0x0000; InitPieVectTable();/ Interrupts that are used in this example are re-mapped to/ ISR functions found within this file. EALLOW; / This is needed to write to EALLOW protected registers PieVectTable.XINT2 = &XINT2_isr; EDIS; / This is needed to disable write to EALLOW protected registers/ 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.INTx5 = 1; XINT2CR =0x1;/*打开管脚xint2外中断*/ /XNMICR=0x1;/*打开nmi中断*/ Enable global Interrupts and higher priority real-time debug events: EINT; / Enable Global interrupt INTM ERTM; / Enable Global realtime interrupt DBGM /初始化CTR扩展板 CTRGR=0; CTRGR=0x80; CTRGR=0; CTRLR=0;/ 关闭东西方向的交通灯 CTRLR=0x40;/ 关闭南北方向的交通灯 CTRLR=0xc1; CTRLR=0xc8;/使能键盘外中断 uPort8000=CTRCLKEY; while ( 1 ) if(a=1) LBDS=0x1;/点亮LED灯 a=0; Delay(256); if(a=0) LBDS=0x0;/关闭LED灯 interrupt void XINT2_isr(void) a=1; PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;void Delay(unsigned int nDelay)/延时int ii,jj,kk=0;for ( ii=0;iinDelay;ii+ ) for ( jj=0;jj512;jj+ )kk+;/=/ No more./=#include DSP281x_Device.h / DSP281x Headerfile Include File#include DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this errupt 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 *)0x108007int 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 = 0xff00;/ 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;/ 初始化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
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 巴西白糖联营协议合同范本
- 买卖合同超预算补充协议
- 特许经营协议ppp项目合同
- 三产融合课件
- 辽宁鞍山市铁东区教育局面向2025年应届毕业生校园招聘40人笔试模拟试题带答案详解
- 难点解析-华东师大版7年级下册期末试题含答案详解
- 难点详解自考专业(学前教育)真题附答案【培优B卷】
- 人力核心指标 行业报告系列 2025年Q3薪智电子设备行业薪酬报告
- 万用表的使用培训课件
- 期货从业资格之《期货基础知识》题库检测试题打印附参考答案详解【巩固】
- 《医用化学基础》教案
- GB/T 9969-2008工业产品使用说明书总则
- GB/T 3618-2006铝及铝合金花纹板
- GB 31645-2018食品安全国家标准胶原蛋白肽
- 防山体滑坡应急预案
- 江苏省社会组织网上办事系统-操作手册
- DB37-T 3079-2017特种设备事故隐患排查治理体系细则
- 2023版江西省乡镇卫生院街道社区卫生服务中心地址医疗机构名单(1744家)
- 模具保养记录表
- 各种隔离标识
- 钢质防火门窗项目商业计划书范文参考
评论
0/150
提交评论