Part Number: MSP430F5529
Tool/software: Code Composer Studio
Original Thread:-e2e.ti.com/.../737345
#include "driverlib.h"
#define TIMER_PERIOD 13105
#define DUTY_CYCLE 82
void main (void)
{
//Stop WDT
WDT_A_hold(WDT_A_BASE);
//P2.0 as PWM output
GPIO_setAsPeripheralModuleFunctionOutputPin(
GPIO_PORT_P2,
GPIO_PIN0
);
//GPIO_setOutputHighOnPin(GPIO_PORT_P2,GPIO_PIN0);
//Generate PWM - Timer runs in Up mode
Timer_A_outputPWMParam param = {0};
param.clockSource = TIMER_A_CLOCKSOURCE_ACLK;
param.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_10;
param.timerPeriod = TIMER_PERIOD;
param.compareRegister = TIMER_A_CAPTURECOMPARE_REGISTER_1;
param.compareOutputMode = TIMER_A_OUTPUTMODE_RESET_SET;
param.dutyCycle = DUTY_CYCLE;
Timer_A_outputPWM(TIMER_A1_BASE, ¶m);
//Enter LPM0
__bis_SR_register(LPM0_bits);
//For debugger
__no_operation();
}
I have written this OutputPWM based MSPware code, which generates the waveform, I desire. I was hoping if I could get the same thing going where I have control over when I toggle the output and perhaps do some processing. From what I know, this can only be done using an ISR, and MSPware Timer library provides the Timer_up/down/upDown along with Capture and compare. However, I am unable to get it to work with the required specifications[4s total period,~25ms ON time]. Could someone help me out?
