1251 views|0 replies

3836

Posts

19

Resources
The OP
 

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.


This post is from DSP and ARM Processors
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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