/* Set the PWM duty of the PWM module. 
The  */
void PWMDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned char ulDuty)
/* Set the PWM duty of the PWM module. 
The  */
void PWMDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned char ulDuty)
{
    unsigned long ulCMRData;
    xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE) ||
            (ulBase == PWMC_BASE));
    if(ulBase == PWMA_BASE)
    {
        xASSERT((ulChannel >= 0) && (ulChannel <= 5));
    }
    else
    {
        xASSERT((ulChannel >= 0) && (ulChannel <= 1));
    }
    xASSERT(((ulDuty > 0) || (ulDuty <= 100)));
    ulCMRData = (PWMMODGet(ulBase) *  ulDuty) / 100;
    if ((PWMMODGet(ulBase) *  ulDuty) / 100 == 0)
    {
        ulCMRData = 0;
    }
    xHWREG(ulBase + TPM_C0V + ulChannel * 8) = ulCMRData;
}