7601 views|9 replies

11

Posts

0

Resources
The OP

Please tell me about using DSP28335 timer to control LED flashing [Copy link]

#include"DSP2833x_Project.h" void delay(Uint32 i) { while(i--); } #define LED1_ON GpioDataRegs.GPASET.bit.GPIO0=1; #define LED2_ON GpioDataRegs.GPASET.bit.GPIO1=1; #define LED3_ON GpioDataRegs.GPASET.bit.GPIO2=1; #define LED4_ON GpioDataRegs.GPASET.bit.GPIO3=1; #define LED5_ON GpioDataRegs.GPASET.bit.GPIO4=1; #define LED6_ON GpioDataRegs.GPASET.bit.GPIO5=1; #define LED7_ON GpioDataRegs.GPASET.bit.GPIO24=1; #define LED8_ON GpioDataRegs.GPASET.bit.GPIO25=1; #define LED1_OFF GpioDataRegs.GPACLEAR.bit.GPIO0=0; #define LED2_OFF GpioDataRegs.GPACLEAR.bit.GPIO1= 0; #define LED3_OFF GpioDataRegs.GPACLEAR.bit.GPIO2=0; #define LED4_OFF GpioDataRegs.GPACLEAR.bit.GPIO3=0; #define LED5_OFF GpioDataRegs.GPACLEAR.bit.GPIO4=0; #define LED6_OFF GpioDataRegs.GPACLEAR.bit. GPIO5=0; #define LED7_OFF GpioDataRegs.GPACLEAR.bit.GPIO24=0; #define LED8_OFF GpioDataRegs.GPACLEAR.bit.GPIO25=0; interrupt void timer0_isr(void); void main(void) { InitSysCtrl(); DINT; InitPieCtrl (); IFR=0X0000; IER=0X0000; InitPieVectTable(); EALLOW; PieVectTable.TINT0=&timer0_isr; EDIS; puTimer0Regs .TCR.all=0x4001; IER|=M_INT1; PieCtrlRegs.PIEIER1.bit.INTx7=1; EINT; for(;;); } int shu; interrupt void timer0_isr(void) { shu++; LED1_ON; delay(5000000); LED1_OFF; LED2_ON; delay(5000000); LED2_OFF; LED3_ON; delay(5000000); LED3_OFF; LED4_ON; delay(5000000); LED4_OFF; LED5_ON; delay(5000000); LED5_OFF; LED6_ON; delay(5000000); (5000000); LED7_OFF; LED8_ON; delay(5000000); LED8_OFF; PieCtrlRegs.PIEACK.all=0x01; CpuTimer0Regs.TCR.bit.TRB=0; CpuTimer0Regs.TCR.bit.TIF=1; } The above is the program I wrote . The result of running on the board is that the lights light up once in a cycle and then go out. What's wrong with this program?

This post is from DSP and ARM Processors

Latest reply

Use an oscilloscope and a multimeter. Take a look at ti's routines. There are examples of GPIO toggle in there.  Details Published on 2017-7-23 21:17

2694

Posts

0

Resources
2
If you use so many delays in your interrupt program, there may be an interrupt conflict. If you light the lamp in this way, there is no need to use interrupts. If you use interrupts, there is no need for delay.
This post is from DSP and ARM Processors
Personal signature作为一个水军,就是尽量的多回帖,因为懂的技术少,所以回帖水分大,见谅!
EEWORLD开发板置换群:309018200,——电工们免费装β的天堂,商家勿入!加群暗号:喵

4

Posts

0

Resources
3
It is recommended to write flags in interrupts, but not to write programs. You can turn off the interrupt enable after entering the interrupt, and then turn on the interrupt after the program is finished running.
This post is from DSP and ARM Processors

11

Posts

0

Resources
4
elvike published on 2017-7-4 20:23 If you use so many delays in your interrupt program, there may be an interrupt conflict. If you light the lights like this, there is no need to use interrupts. Using interrupts eliminates the need...
How to achieve the effect of running lights without delay?
This post is from DSP and ARM Processors

11

Posts

0

Resources
5
QQ20041050 Published on 2017-7-4 21:17 It is recommended to write flags in interrupts, but not to write programs. You can turn off the interrupt enable after entering the interrupt, and then turn on the interrupt after the program is finished running.
Yeah, thanks for the reply. I'll give it a try.
This post is from DSP and ARM Processors

11

Posts

0

Resources
6
QQ20041050 Published on 2017-7-4 21:17 It is recommended to write flags in interrupts, but not to write programs. You can turn off the interrupt enable after entering the interrupt, and then turn on the interrupt after the program is finished running.
Turning TIE off and on again as you said still doesn't work. . It won't light up as long as it is turned off.
This post is from DSP and ARM Processors

11

Posts

0

Resources
7
elvike published on 2017-7-4 20:23 If you use so many delays in your interrupt program, there may be an interrupt conflict. If you light the lamp like this, there is no need to use interrupts. If you use interrupts, there is no need...
It seems that the delay still doesn't work. I don't know what the problem is. The interrupt keeps running.
This post is from DSP and ARM Processors

2694

Posts

0

Resources
8
Use the emulator to add a breakpoint in the interrupt to see if the interrupt is entered. If it is, use an oscilloscope to check the status of your IO port. Your thinking is not very clear, or you do not know how the interrupt is related to the main program. relation.
This post is from DSP and ARM Processors
Personal signature作为一个水军,就是尽量的多回帖,因为懂的技术少,所以回帖水分大,见谅!
EEWORLD开发板置换群:309018200,——电工们免费装β的天堂,商家勿入!加群暗号:喵

11

Posts

0

Resources
9
elvike published on 2017-7-23 15:08 Use the emulator to add a breakpoint in the interrupt to see if the interrupt is entered. If it is, use an oscilloscope to check the status of your IO port. Your idea is not very clear...
Thank you. I added a variable to the interrupt. The variable keeps adding itself, which means it enters the interrupt. I am using a DSP28335 board. The LED light does not have an output IO port, but I can use the GPIO bits to define and control the high and low level status of the LED. How do I detect the IO port status?
This post is from DSP and ARM Processors

Comments

Use an oscilloscope and a multimeter. Look for TI's routines, which contain examples of GPIO toggle.  Details Published on 2017-7-23 21:17

2694

Posts

0

Resources
10
zhuhaow published on 2017-7-23 15:38 Thank you. I added a variable to the interrupt. The variable keeps adding itself, which means it enters the interrupt. I am using a DSP28335 board, but the LED lights are not...
Use an oscilloscope and a multimeter. Take a look at ti's routines. There are examples of GPIO toggle in there.
This post is from DSP and ARM Processors
Personal signature作为一个水军,就是尽量的多回帖,因为懂的技术少,所以回帖水分大,见谅!
EEWORLD开发板置换群:309018200,——电工们免费装β的天堂,商家勿入!加群暗号:喵

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

    Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
    快速回复 返回顶部 Return list