4054 views|4 replies

6

Posts

0

Resources
The OP
 

Newbie asks for advice on the timing problem of msp430 timer [Copy link]

#include  

void main(void) int i=0; WDTCTL =WDTPW+WDTHOLD; P2DIR = 0X01;P2OUT = 0X01; P3DIR = 0X01;P3OUT = 0X01; P1DIR = 0X01;P1OUT = 0X01; //Set P1 port direction to outputwhile(i<10) { TA0CCR0=32768; //1S TACCTL0=CCIE; TA0CTL =TASSEL_1+MC_1+TACLR; //ACLK, up counting mode i++; TA0CCR0=0; } __bis_SR_register(LPM3_bits); } #pragma vector = TIMERA0_VECTOR __interrupt void Timer_A0_ISR (void) { P1OUT ^= 0X01; } The requirement is to set a 6s timer. I used an LED light to test it, but I couldn't enter the timer interrupt. Please give me some advice.



This post is from MCU

Latest reply

Do not repeatedly initialize the timer  Details Published on 2018-7-25 18:28
 

1059

Posts

1

Resources
2
 
Interrupt is not enabled
This post is from MCU
 
 

1234

Posts

4

Resources
3
 
while(i<10) Oh my god, am I so casual?
This post is from MCU
 
Personal signature天地庄周马;江湖范蠡船。
个性签名还是放QQ号吧,2060347305,添加说明EEworld好友
 
 

4005

Posts

0

Resources
4
 
Do not repeatedly initialize the timer
This post is from MCU
 
 
 

6

Posts

0

Resources
5
 
Do not add a while loop in the main function to count in the interrupt function. The problem has been solved.
This post is from MCU
 
 
 

Guess Your Favourite
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