Hello, I am new to the MSP430 and I have been having troubles with the duty cycle. The problem is that I need a duty cycle of 8.33us, with 6.68us one output (P1.0) and 1.45us(P1.6) but the maximum frequency of the MSP430G2231 from what I've read is 32,768.
Here is the sample code I've been using to perform this.
#include "io430.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x41; // P1.0 output and P1.6 output
CCTL0 = CCIE; // CCR0 interrupt enabled
CCR0 = 1000-1;
TACTL = TASSEL_1 + MC_1; // ACLK, upmode
// _BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/ interrupt causes error, must not be from this MCU.
}
// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
P1OUT ^= 0x01; // Toggle P1.0
CCR0 += 1000-1; //add offset to CCR0
}
Thanks in advance.