Misunderstanding of using XF pin in DSP program interruption during programming[Copy link]
It is common to use the XF pin to flash an LED in the 5509 DSP program interrupt, but there is a misunderstanding. The following analysis is made, taking the timer to control the LED as an example: void main() { init_5509(); init_timer(); while(1) { asm(" NOP"); } } interrupt void int_timer0() { Flag=Flag+1; if (Flag>10) asm(" SSBX XF"); else asm(" RSBX XF"); if (Flag>20) Flag=0; } Copy code This program cannot achieve control. When using XF, please pay attention. XF is a bit of ST1, but in the interrupt, ST1 is first pushed into the stack and popped out of the stack before the interrupt, so changing XF in the interrupt has no practical meaning. So be careful when adding assembly in C/C++. The modified program is as follows: void main() { init_5509(); init_timer(); while(1) { asm(" NOP"); if (Flag>10) asm(" SSBX XF"); else asm(" RSBX XF"); } } interrupt void int_timer0() { Flag=Flag+1; if (Flag>20) Flag=0; } Copy the code and the program will work.