DlnPwmSetFrequency() Function

The DlnPwmSetFrequency() function defines the PWM frequency.

Syntax
C/C++
DLN_RESULT DlnPwmSetFrequency(
   HDLN handle, 
   uint8_t port,
   uint8_t channel,
   uint32_t frequency,
   uint32_t* actualFrequency
);
Parameters
handle

A handle to the DLN-series adapter.

port

A number of the PWM port.

channel

A number of the PWM channel.

frequency

The frequency value, specified in Hz. You may specify any value within the range, supported by the DLN-series adapter. This range can be retrieved using the respective function. If you enter an incompatible value, it will be approximated as the closest lower frequency value, supported by the adapter.

actualFrequency

A pointer to an unsigned 32-bit integer that receives the actually set frequency approximated as the closest to user-defined lower value.

Return Value
DLN_RES_SUCCESS (0x00)

The function successfully defined the frequency 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_VALUE_ROUNDED (0x21)

The function approximated the frequency value to the closest supported value.

Remarks

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