/* Get the PWM duty of the PWM module. 
The  */
unsigned long PWMDutyGet(unsigned long ulBase, unsigned long ulChannel)
/* Get the PWM duty of the PWM module. 
The  */
unsigned long PWMDutyGet(unsigned long ulBase, unsigned long ulChannel)
{
    unsigned long ulChannelTemp;
    unsigned long ulCMRData;
    unsigned long ulCNRData;
    ulChannelTemp = ulChannel;
    xASSERT(ulBase == PWMA_BASE);
    xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
    ulCNRData = (xHWREG(ulBase + PWM_CNR0 +(ulChannelTemp * 4)));
    ulCMRData = (xHWREG(ulBase + PWM_CMR0 +(ulChannelTemp * 4)));
    if(xHWREG(ulBase + PWM_PCR) & PWM_CENTER_ALLIGNED_TYPE)
    {
        ulChannelTemp = (ulCNRData - ulCMRData) * 100 / (ulCNRData + 1);
    }
    else
    {
        ulChannelTemp = (ulCMRData + 1) * 100 / (ulCNRData + 1);
        ulChannelTemp = 100-ulChannelTemp;
    }
    return ulChannelTemp;
}