Part Number:MSP430F5529
Tool/software: Code Composer Studio
Hi guys , I have a problem with my codes like below.
I want to make this :
If I push the switch, frequency of blinking LED is decrease. And when I push it repeatedly, it also decreases as pushing.
I made it by using interrupt and Timer A .
When I operate, it blinked repeatedly but didn't change frequency.
Where should I fix ??
void main(void) {
__bis_SR_register(GIE); //Interrupt
while(1)
{
P1OUT ^= BIT7; //LED TOGGLE
if(button_cnt==0)
__delay_cycles(1000);
else if(button_cnt==1)
__delay_cycles(100000);
}
}
// Timer interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
{
cnt++;
if(cnt > 1000){
cnt = 0;
P1OUT ^= BIT0;
}
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
button_cnt++;
button_cnt=button_cnt%4;
P1IFG &= ~BIT7; //IFG is cleared
}