USB-I2C/SPI/GPIO Interface Adapters
Published on USB-I2C/SPI/GPIO Interface Adapters (https://dlnware.com)

Home > C/C++ API > PWM (Pulse Width Modulation) Interface > PWM Functions > DlnPwmGetDutyCycle() Function

DlnPwmGetDutyCycle() Function

The DlnPwmGetDutyCycle() function retrieves the current PWM duty cycle value.

Syntax
C/C++
DLN_RESULT DlnPwmGetDutyCycle(
   HDLN handle, 
   uint8_t port,
   uint8_t channel,
   double* dutyCycle
);
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 pointer to the double precision floating point number that receives the current duty cycle.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully retrieved the current duty cycle value.

DLN_RES_INVALID_PORT_NUMBER (0xA8)

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

DLN_RES_INVALID_CHANNEL_NUMBER (0xC0)

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

Remarks

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


Links
[1] http://dlnware.com/dll/DlnPwmGetPortCount [2] http://dlnware.com/dll/DlnPwmGetChannelCount