/* Sets the signal's duty cycle in percent (1-100). */
int pwmSetDutyCycle(uint32_t percentage)
/* Sets the signal's duty cycle in percent (1-100). */
int pwmSetDutyCycle(uint32_t percentage)
{
  if ((percentage < 1) || (percentage > 100))
  {
    return -1;
  }
  TMR_TMR16B1MR0 = (pwmPulseWidth * (100 - (pwmDutyCycle = percentage))) / 100;
  return 0;
}