Part Number: MSP432P401R
Tool/software: Code Composer Studio
this code is from one of the example i found online
#include "msp.h" int main(void) { void redirect(void); __disable_irq(); /* set up TA0.4 to do compare */ TIMER_A0->CTL = 0x02E4; /* SMCLK, ID = /8, continuous mode, TA clear */ TIMER_A0->EX0 = 7; /* IDEX = /8 */ TIMER_A0->CCTL[4] = TIMER_A_CCTLN_OUTMOD_6; /* OUTMOD = toggle */ TIMER_A0->CCR[4] = 11719; /* toggle point 11719*/ TIMER_A0->CCTL[4] |= 0x10; /* enable CC interrupt */ /* Configure P2.7 as Timer A0.4 compare output */ P2->SEL0 |= 0x80; P2->SEL1 &= ~0x80; P2->DIR |= 0x80; redirect(); /* connect TA0.4 output to pin P2.1 */ NVIC_SetPriority(TA0_N_IRQn, 3); /* set priority to 3 in NVIC */ NVIC_EnableIRQ(TA0_N_IRQn); /* enable interrupt in NVIC */ __enable_irq(); /* global enable IRQs */ while (1) { } } void TA0_N_IRQHandler(void) { TIMER_A0->CCTL[4] &= ~1; /* clear interrupt flag */ TIMER_A0->CCR[4] += 11719; /* schedule next toggle */ }
/* This function connects the output of TA0.4 to pin P2.1 */
void redirect(void) {
PMAP->KEYID = 0x2D52; /* unlock PMAP */
P2MAP->PMAP_REGISTER1 = PMAP_TA0CCR4A; /* 23, map P2.1 to TA0.4 */
P2->DIR |= 2; /* set up P2.1 to take TA0.4 output */
P2->SEL0 |= 2;
P2->SEL1 &= ~2;
PMAP->CTL = 1; /* lock PMAP */
PMAP->KEYID = 0;
}
i can adjust the speed blinking but i have no idea where i can adjust the intensity of light? i want the intensity to be lower. any idea?