Hi all,
I would like to toggle my PWM outputs on and off, but one should be on when the other is off. For example, I have four PWM signals: PWM1, PWM2, PWM3 and PWM4. PWM1 and PWM3 are a pair, so is PWM2 and PWM4.
When PWM1 and PWM3 are on, PWM2 and PWM4 should be off. I wrote a little bit of code which toggles these outputs, but so far it either toggles them all off or all on. This is the gist of my code.
int i = 0;
bool bArrayTrueFalse = {true, false};
bool bArrayFalseTrue = {false, true};
if(1 second has passed)
{
i++;
if(i==2)
{
i=0;
}
PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, bArrayTrueFalse[i]);
PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT, bArrayFalseTrue[i]);
PWMOutputState(PWM0_BASE, PWM_OUT_2_BIT, bArrayTrueFalse[i]);
PWMOutputState(PWM0_BASE, PWM_OUT_3_BIT, bArrayFalseTrue[i]);
}
Is this even possible? If so, anybody have any suggestions?