Hy guys,
i want to realize a little project which deals with debouncing the button.
For this I want to use 2 interrupts (port and timer).
I don't know if my code is to complicated for my application, but I'm really interested in your solutions.
//*****************************************************************************
//
// MSP432 main.c template - Empty main
//
//****************************************************************************
#include "msp.h"
void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P1DIR|=BIT0;
P1OUT&=~BIT1;
P1IE|=BIT1;
P1IES|=BIT1;
// P1REN|=BIT1;
__enable_interrupt();
NVIC_ISER1 = 1 << ((INT_PORT1 - 16) & 31);
NVIC_ISER0 = 1 << ((INT_TA0_0 - 16) & 31);
}
void Port1_IsrHandler(void)
{
P1OUT^=BIT0;
P1IFG&=~BIT1;
P1IES^=BIT1;
TA0CCTL0 = CCIE; // TACCR0 interrupt enabled
TA0CTL = TASSEL_2 | MC_1; // SMCLK, continuous mode
TA0CCR0=1500;
}
void TA0_IsrHandler(void)
{
P1OUT ^= BIT0;
TA0CCTL0 &= CCIE;
}
thank for your help.
Chris