sub_pwm_config

Top  Previous  Next
Got to SUB-20 page

Synopsis

int sub_pwm_config( sub_handle hndl, int res_us, int limit )

 

Configure PWM module.

Parameters

res_us - PWM module clock resolution in µs. Resolution range is 20µs - 16384µs.

limit - PWM module counter limit in range 0-255. If limit is 0 PWM module will be turned off.

PWM frequency

Resolution and limit define PWM module frequency

 

Fpwm = 1000000/(res_us * limit) Hz

 

PWM frequency range is

 

Fpwm_min = 1000000/(20 * 2) = 25000 Hz = 25KHz

Fpwm_max = 1000000/(16384 * 255) = 0.238 Hz

Return value

On success function returns 0. Otherwise error code.

See also

sub_pwm_set

Error Codes

Compatibility

FW version

0.1.8 or grater

Library version

0.1.12.10 or grater