DlnPwmSetDutyCycle() Function

The DlnPwmSetDutyCycle() function defines a PWM duty cycle value, which is the ratio of the high time to the PWM period.

Syntax
C/C++
DLN_RESULT DlnPwmSetDutyCycle(
   HDLN handle, 
   uint8_t port, 
   uint8_t channel,
   double dutyCycle,
   double* actualDutyCycle
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the PWM port.

channel

A number of the PWM channel.

dutyCycle

A double precision floating point number. Must contain a duty cycle that should to be set. The value is specified in percents.

actualDutyCycle

A pointer to a double precision floating point number that receives the actual duty cycle value.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully defined the duty cycle value.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

The port number is not valid. Use the DlnPwmGetPortCount() function to find the maximum possible port number.

DLN_RES_INVALID_CHANNEL_NUMBER (0xC0)

The channel number is not valid. Use the DlnPwmGetChannelCount() function to find the maximum possible port number.

DLN_RES_PWM_INVALID_DUTY_CYCLE (0xC4)

The provided value is not valid.

Remarks

The DlnPwmSetDutyCycle() function is defined in the dln_pwm.h file.