DSPRelated.com
Forums

Problem on use PWM as output on 56807

Started by lisong_yuan October 17, 2005

I want to configure 4 of PWMA pins as output pin. But I can not get
the output. The following is my code. Please help asap. Thanks.
void initPwmAReg(void)
{
setPwmAControl(0x00001); // 0x0001 PWMEN Enable
setPwmAOutputControl(0x8F0F);
setPwmAConfigReg(0x000E );
setPwmAModulo(200);
setPwmA_ENHA();
setPwmAChannelControlReg(0xB000);
setPwmADisableMapping1Reg(0x0000);
setPwmADisableMapping2Reg(0x0000);
} void loadPwmAValues(UWord16 kIndex)
{
int i;
clearPwmALoadOK();
for ( i = 0; i < 4; ++i)
{
setPwmAValue(0xFFFF, i);
}
setPwmALoadOK();
}



I want to configure 4 of PWMA pins as output pin. But I can not get the output. The following is my code. Please help asap. Thanks.
void initPwmAReg(void)
{
setPwmAControl(0x00001); // 0x0001 PWMEN Enable
setPwmAOutputControl(0x8F0F);
setPwmAConfigReg(0x000E );
setPwmAModulo(200);
setPwmA_ENHA();
setPwmAChannelControlReg(0xB000);
setPwmADisableMapping1Reg(0x0000);
setPwmADisableMapping2Reg(0x0000);
} void loadPwmAValues(UWord16 kIndex)
{
int i;
clearPwmALoadOK();
for ( i = 0; i < 4; ++i)
{
setPwmAValue(0xFFFF, i);
}
setPwmALoadOK();
}



I think you have a problem with the PWM value. It should be set to
0x7FFF to obtain a 100% output. Remember that the PWM value is a 16-bit
signed value (User Manual rev. 6, section 11.9.7). A negative value
(0xFFFF is equal to -1) deactivates the PWM output for the entire PWM
period.

Roberto

-----Messaggio originale-----
Da: motoroladsp@moto... [mailto:motoroladsp@moto...] Per
conto di lisong_yuan
Inviato: luned17 ottobre 2005 19.49
A: motoroladsp@moto...
Oggetto: [motoroladsp] Problem on use PWM as output on 56807
I want to configure 4 of PWMA pins as output pin. But I can not get
the output. The following is my code. Please help asap. Thanks.
void initPwmAReg(void)
{
setPwmAControl(0x00001); // 0x0001 PWMEN Enable
setPwmAOutputControl(0x8F0F);
setPwmAConfigReg(0x000E );
setPwmAModulo(200);
setPwmA_ENHA();
setPwmAChannelControlReg(0xB000);
setPwmADisableMapping1Reg(0x0000);
setPwmADisableMapping2Reg(0x0000);
} void loadPwmAValues(UWord16 kIndex)
{
int i;
clearPwmALoadOK();
for ( i = 0; i < 4; ++i)
{
setPwmAValue(0xFFFF, i);
}
setPwmALoadOK();
}


Hi,

If you want to use a PWM pin as a simple output pin (no PWM), you should
read the section "11.5 software output control" of the user's manual.
As I can see in your init function, you want to use PWMA0 to PWMA3 as output
(PMOUT = 0x8F0F). In the register you have enable the output pad (PAD_EN =
1), enable the output control of PWMA0 to PWMA3 (OUTCTL0 to OUTCTL3 = 1) and
set those output to 1 (OUT0 to OUT3 = 1).
Then, if you want to change the value of OUT0 to OUT3 of this same register.

Example:
If you want PWMA0 and PWMA3 to set and PWMA1 and PWMA2 to be clear, just
write "setPwmAOutputControl(0x8F0A);"

You don't have to play with the PWM value register for those outputs. Bruno Tremblay

-----Message d'origine-----
De: motoroladsp@moto... [mailto:motoroladsp@moto...] De la
part de lisong_yuan
Envoy 17 octobre 2005 13:49
: motoroladsp@moto...
Objet: [motoroladsp] Problem on use PWM as output on 56807 I want to configure 4 of PWMA pins as output pin. But I can not get
the output. The following is my code. Please help asap. Thanks.
void initPwmAReg(void)
{
setPwmAControl(0x00001); // 0x0001 PWMEN Enable
setPwmAOutputControl(0x8F0F);
setPwmAConfigReg(0x000E );
setPwmAModulo(200);
setPwmA_ENHA();
setPwmAChannelControlReg(0xB000);
setPwmADisableMapping1Reg(0x0000);
setPwmADisableMapping2Reg(0x0000);
} void loadPwmAValues(UWord16 kIndex)
{
int i;
clearPwmALoadOK();
for ( i = 0; i < 4; ++i)
{
setPwmAValue(0xFFFF, i);
}
setPwmALoadOK();
}