2395 views|1 replies

3

Posts

0

Resources
The OP
 

MSP430F5529 cannot enter interrupt [Copy link]

The timer generates a PWM square wave output to P1.4, and then S1 controls the duty cycle of the PWM wave s1---p1.7TA0CCR3----P1.4 (There is no problem with generating PWM wave and controlling the duty cycle, but it cannot be controlled by key interrupt, and there is no problem with the header file) void GPIO_init(); unsigned int freq=10; void main() { WDTCTL = WDTPW + WDTHOLD; SPWM_1Way_Init(); SPWM_1Way_Set_Freq(10); GPIO_init(); _EINT();//Open the total interrupt } void GPIO_init() { P1REN |=BIT7; P1OUT |=BIT7; P1IE |=BIT7; P1IES|=BIT7; P1IFG&=~BIT7; } void SPWM_1Way_Init(void) { spwm_i=0; TA0CCR0 =198;//Carrier 126.26KHZ TA0CCR3 =Lab1[spwm_i]; TA0CCTL3 =OUTMOD_7; TA0CTL =TASSEL_2+MC_1+TACLR;//Select clock as SMCLK, UP mode TA1CCR0 =2499;//25000000/(100*100)=2500:100Hz, 100 points: 10KHZ (the time is not accurate, I made some compensation) TA1CTL =TASSEL_2+MC_1+TACLR;//Select clock as SMCLK, UP mode } void SPWM_1Way_Set_Freq(unsigned int freq) { unsigned long freq_num; freq_num=250000/(freq)-1; TA1CCR0 =freq_num; } #pragma vector=PORT1_VECTOR __interrupt void PORT17ISR(void) { TA0CCR3 =Lab1[spwm_i++]; if(spwm_i==100)spwm_i=0; TA1IV=0; }



This post is from Microcontroller MCU

Latest reply

The program is missing a while infinite loop  Details Published on 2018-7-16 08:18
 

1059

Posts

1

Resources
2
 
The program is missing a while infinite loop
This post is from Microcontroller 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