完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
main code:
#include #include #include #include #include /* This is a simple timer example to set the timer with */ /* an interrupt period of 0x400 cycles. */ /* The example uses predefined CSL macros and symbolic */ /* constants to create the correct register settings */ /* needed to configure the timer. */ /* Reference start of interrupt vector table */ /* This symbol is defined in file, vectors.s55 */ extern void VECSTART(void); extern void _timer_isr(void); //#define TIMER_CTRL TIMER_TCR_RMK( // TIMER_TCR_SOFT_BRKPTNOW, /* SOFT == 0 */ // TIMER_TCR_FREE_WITHSOFT, /* FREE == 0 */ // TIMER_TCR_TRB_RESET, /* ARB == 1 */ // TIMER_TCR_TSS_START, /* TSS == 0 */ // TIMER_TCR_TDDR_OF(0) //) /* Create a TIMER configuration structure that can be passed */ /* to TIMER_config CSL function for initialization of Timer */ /* control registers. */ TIMER_Config timCfg0 = [ 0x0669, /* TCR0 */ // 0x1000 , /* TSCR */ 0x270f /* PRD */ ]; Uint16 eventId0; /* Create a TIMER_Handle object for use with TIMER_open */ TIMER_Handle mhTimer0; volatile Uint16 timer0_cnt = 0; /* Function/ISR prototypes */ interrupt void timer0Isr(void); void taskFxn(void); int old_intm; Uint16 tim_val; Uint16 xfchange = 0; void main(void) [ /* Initialize CSL library - This is REQUIRED !!! */ /*CLS库的初始化,这是必需的*/ CSL_init(); /* Set IVPH/IVPD to start of interrupt vector table */ /*修改寄存器IVPH,IVPD,重新定义中断向量表*/ IRQ_setVecs((Uint16)(&VECSTART)); /* Temporarily disable all maskable interrupts */ /*禁止所有可屏蔽的中断源*/ old_intm = IRQ_globalDisable(); /* Open Timer 0, set registers to power on defaults */ /*打开定时器0,设置其为上电的的默认值,并返回其句柄*/ mhTimer0 = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET); /* Get Event Id associated with Timer 0, for use with */ /* CSL interrupt enable functions. */ /*获取定时器0的中断ID号*/ eventId0 = TIMER_getEventId(mhTimer0); /* Clear any pending Timer interrupts */ /*清除定时器0的中断状态位*/ IRQ_clear(eventId0); /* Place interrupt service routine address at */ /* associated vector location */ /*为定时器0设置中断服务程序*/ IRQ_plug(eventId0,&timer0Isr); /* Write configuration structure values to Timer control regs */ /*设置定时器0的控制与周期寄存器*/ TIMER_config(mhTimer0, &timCfg0); /* Enable Timer interrupt */ /*使能定时器的中断*/ IRQ_enable(eventId0); /* Enable all maskable interrupts */ /*设置寄存器ST1的INTM位,使能所有的中断*/ IRQ_globalEnable(); /* Start Timer */ /*启动定时器0*/ TIMER_start(mhTimer0); for(;;) [ /* Wait for at least 10 timer periods */ /*等待10个定时周期*/ if(xfchange == 0) [ /*点亮XF的LED*/ asm(" RSBX XF "); ] else [ /*关掉XF的LED*/ asm(" SSBX XF "); ] ] /* Restore old value of INTM */ /*恢复INTM旧的值*/ // IRQ_globalRestore(old_intm); /* We are through with timer, so close it */ /*关掉定时器0*/ // TIMER_close(mhTimer0); ] /*定时器0的中断程序*/ interrupt void timer0Isr(void) [ ++timer0_cnt; if(timer0_cnt == 500) [ xfchange = 1; ] if(timer0_cnt == 1000) [ timer0_cnt = 0; xfchange = 0; ] ] 构建中断向量程序(vector.asm) ********************************************************************************* * Vector.ASM v1.00 * * 版权(c) 2000- 北京合众达电子技术有限责任公司 * * 设计者: 钱建良 * ********************************************************************************* .file "memory.asm" .c_mode .mmregs .ref _main .ref _timer_isr .def IV_RESET .global _VECSTART .sect ".vector" _VECSTART: IV_RESET: BD _main ; 复位中断,跳转到程序的入口 NOP NOP IV_NMI: RETE ; NMI中断,开中断返回 NOP NOP NOP IV_SINT17: RETE ; 软件中断#17,开中断返回 NOP NOP NOP IV_SINT18: RETE ; 软件中断#18,开中断返回 NOP NOP NOP IV_SINT19: RETE ; 软件中断#19,开中断返回 NOP NOP NOP IV_SINT20: RETE ; 软件中断#20,开中断返回 NOP NOP NOP IV_SINT21: RETE ; 软件中断#21,开中断返回 NOP NOP NOP IV_SINT22: RETE ; 软件中断#22,开中断返回 NOP NOP NOP IV_SINT23: RETE ; 软件中断#23,开中断返回 NOP NOP NOP IV_SINT24: RETE ; 软件中断#24,开中断返回 NOP NOP NOP IV_SINT25: RETE ; 软件中断#25,开中断返回 NOP NOP NOP IV_SINT26: RETE ; 软件中断#26,开中断返回 NOP NOP NOP IV_SINT27: RETE ; 软件中断#27,开中断返回 NOP NOP NOP IV_SINT28: RETE ; 软件中断#28,开中断返回 NOP NOP NOP IV_SINT29: RETE ; 软件中断#29,开中断返回 NOP NOP NOP IV_SINT30: RETE ; 软件中断#30,开中断返回 NOP NOP NOP ********************************************************************************* * 本程序未用此中断 * ********************************************************************************* IV_INT0: RETE NOP NOP NOP ********************************************************************************* * 本程序未用此中断 * ********************************************************************************* IV_INT1: RETE NOP NOP NOP ********************************************************************************* * 外部中断#2:本系统未用 * ********************************************************************************* IV_INT2: RETE NOP NOP NOP ********************************************************************************* * 内部定时中断#0:本系统未用 * ********************************************************************************* IV_TINT0: BD _timer_isr PSHM ST0 PSHM ST1 ********************************************************************************* * McBSP#0 接收中断:本系统未用 * ********************************************************************************* IV_BRINT0:RETE NOP NOP NOP ********************************************************************************* * McBSP#0 发送中断:本系统未用 * ********************************************************************************* IV_BXINT0:RETE NOP NOP NOP ********************************************************************************* * DMA通道#0 中断:本系统未用 * ********************************************************************************* IV_DMAC0: RETE NOP NOP NOP ********************************************************************************* * 内部定时中断#1:本系统未用 * ********************************************************************************* IV_TINT1: RETE NOP NOP NOP ********************************************************************************* * 外部中断#3:本系统未用 * ********************************************************************************* IV_INT3: RETE NOP NOP NOP ********************************************************************************* * HPI中断:本系统未用 * ********************************************************************************* IV_HPINT: RETE NOP NOP NOP ********************************************************************************* * McBSP#1 接收中断:本系统未用 * ********************************************************************************* IV_BRINT1: RETE NOP NOP NOP ********************************************************************************* * McBSP#1 发送中断:本系统未用 * ********************************************************************************* IV_BXINT1: RETE NOP NOP NOP ********************************************************************************* * DMA通道#4 中断:本系统未用 * ********************************************************************************* IV_DMAC4: RETE NOP NOP NOP ********************************************************************************* * DMA通道#5 中断:本系统未用 * ********************************************************************************* IV_DMAC5: RETE NOP NOP NOP .end cmd file: /**********************************************************/ /* */ /* LINKER command file for LEAD3 memory map */ /* */ /**********************************************************/ MEMORY [ PAGE 0: MMR : origin = 0000000h, length = 00000c0h SPRAM : origin = 00000c0h, length = 0000040h VECS : origin = 0000100h, length = 0000100h DARAM0 : origin = 0000200h, length = 0003E00h DARAM1 : origin = 0004000h, length = 0004000h DARAM2 : origin = 0008000h, length = 0004000h DARAM3 : origin = 000c000h, length = 0004000h SARAM0 : origin = 0010000h, length = 0004000h SARAM1 : origin = 0014000h, length = 0008000h /* SARAM2 : origin = 0018000h, length = 0004000h */ SARAM3 : origin = 001c000h, length = 0004000h SARAM4 : origin = 0020000h, length = 0004000h SARAM5 : origin = 0024000h, length = 0004000h SARAM6 : origin = 0028000h, length = 0004000h SARAM7 : origin = 002c000h, length = 0004000h SARAM8 : origin = 0030000h, length = 0004000h SARAM9 : origin = 0034000h, length = 0004000h SARAM10 : origin = 0038000h, length = 0004000h SARAM11 : origin = 003c000h, length = 0004000h SARAM12 : origin = 0040000h, length = 0004000h SARAM13 : origin = 0044000h, length = 0004000h SARAM14 : origin = 0048000h, length = 0004000h SARAM15 : origin = 004c000h, length = 0004000h CE0 : origin = 0050000h, length = 03b0000h CE1 : origin = 0400000h, length = 0400000h CE2 : origin = 0800000h, length = 0400000h CE3 : origin = 0c00000h, length = 03f8000h PDROM : origin = 0ff8000h, length = 07f00h /* VECS : origin = 0ffff00h, length = 00100h */ /* reset vector */ ] SECTIONS [ .vectors : [] > VECS PAGE 0 /* interrupt vector table */ .cinit : [] > SARAM0 PAGE 0 .text : [] > SARAM1 PAGE 0 .stack : [] > DARAM0 PAGE 0 .sysstack: [] > DARAM0 PAGE 0 .sysmem : [] > DARAM1 PAGE 0 .cio : [] > DARAM1 PAGE 0 .data : [] > DARAM1 PAGE 0 .bss : [] > DARAM1 PAGE 0 .const : [] > DARAM1 PAGE 0 .csldata : [] > DARAM0 PAGE 0 dmaMem : [] > DARAM0 PAGE 0 ] 编译的结果: warning: creating output section ".vector" without a SECTIONS specification undefined first referenced symbol in file --------- ---------------- _timer_isr F:\DSP5416_SourceCode\timer\Debug\vector.obj error: unresolved symbols remain error: errors encountered during linking; "./Debug/timer0.out" not built >> Compilation failure |
|
相关推荐
10 个讨论
|
|
只有小组成员才能发言,加入小组>>
MSP430F249TPMR出现高温存储后失效了的情况,怎么解决?
563 浏览 1 评论
对于多级放大电路板,在PCB布局中,电源摆放的位置应该注意什么?
1013 浏览 1 评论
647 浏览 0 评论
普中科技F28335开发板每次上电复位后数码管都会显示,如何熄灭它?
488 浏览 1 评论
1011 浏览 0 评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
111浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
86浏览 14评论
在使用3254进行录音的时候出现一个奇怪的现象,右声道有吱吱声,请教一下,是否是什么寄存器设置存在问题?
104浏览 13评论
TLV320芯片内部自带数字滤波功能,请问linein进来的模拟信号是否是先经过ADC的超采样?
95浏览 12评论
TPA6304-Q1: TPA6304 两片公用一组I2C的话,其中一片配置不成功怎么办
118浏览 10评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-1 08:06 , Processed in 1.001492 second(s), Total 66, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号