Introduce the misunderstanding of using XF pin in 509 DSP program interrupt[Copy link]
Let's start with some simple test programs. Making an LED flash is often used, but there is a misunderstanding in it. The following analysis is made, taking the timer to control the LED light 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.