Hello Community,
I found this really amazing Code from oPossoum in the Code Vault for fading a LED. The problem is, I would like to make both LED on the launchPad fading.
I am really new to MSP430G2553 and played a lot with the Code, tried to understand Clocks, Interrupts, etc. , but I am not able to get it :/
Can anybody help me how to or give me a good advice? Thanks!
#include <msp430.h>
#include <stdint.h>
void main(void)
{
WDTCTL = WDTPW | WDTHOLD;
DCOCTL = 0; BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ;
P1DIR = P1SEL = BIT6;
TACCTL1 = OUTMOD_7; TACTL = TASSEL_2 | MC_2 | TAIE;
_EINT();
}
#pragma vector = TIMER0_A1_VECTOR
__interrupt void timer_a1_isr(void)
{
static uint32_t x = 0x00100000L;
static unsigned d = 1;
TACCR1 = x >> 16;
volatile unsigned z = TAIV;
if(d) {
x += (x >> 7); if(x > 0xF8000000L) d = 0;
} else {
x -= (x >> 7); if(x < 0x00200000L) d = 1;
}
}