2124 views|2 replies

6

Posts

0

Resources
The OP
 

Newbie seeking guidance, about msp430led water lamp code problem [Copy link]

Function name: Timer_A Function: Interrupt service function of timer A, where the flow direction and flow speed of the water lamp are controlled by the flag Parameter: None Return value: None **********************************************/ #pragma vector = TIMERA0_VECTOR __interrupt void Timer_A (void) { if(flag == 0) { P2OUT = ~(0x80>>(i++)); //The lighting order of the lamp is D8 -> D1 } else if(flag == 1) { P2OUT = ~(0x01<<(i++)); //The lighting order of the lamp is D1 -> D8 } else { if(dir) //The lighting order of the lamp is D8 -> D1, D1 -> D8, looping around { P2OUT = ~(0x80>>(i++)); } else { P2OUT = ~(0x01<<(i++)); } } ...... The following code is omitted. What I want to ask is if(flag == 0) { P2OUT = ~(0x80>>(i++)); //The order of lights turning on D8 -> D1 }. In this paragraph, when flag=0, i++=0, D8 is on. There is no for statement loop for i here. Why does the comment say that D8-D1 will turn on in sequence?



This post is from Suggestions & Announcements

Latest reply

Because the interrupt will always enter, it is equivalent to a for loop  Details Published on 2018-7-18 08:12
 
 

1059

Posts

1

Resources
2
 
Because the interrupt will always enter, it is equivalent to a for loop
This post is from Suggestions & Announcements

赞赏

1

查看全部赞赏

 
 
 

6

Posts

0

Resources
3
 
qwerghf posted on 2018-7-18 08:12 Because the interrupt will always enter, it is equivalent to a for loop
Yes, thank you.
This post is from Suggestions & Announcements
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

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