TS-8820-pwm: Difference between revisions
From embeddedTS Manuals
(Removed H Bridge references) |
(Removed incorrect use of "prescalar," still able to be kept backwards compatible with other 8820 based devices.) |
||
Line 1: | Line 1: | ||
The TS-8820 has 6 PWM outputs. PWM channels 1 to 6 feed digital outputs 1 to 6 respectively when the PWM override bit is set for a given output. | The TS-8820 has 6 PWM outputs. PWM channels 1 to 6 feed digital outputs 1 to 6 respectively when the PWM override bit is set for a given output. | ||
For all 8 PWM channels, the PWM frequency is approximately (12207/(2^ | For all 8 PWM channels, the PWM frequency is approximately (12207/(2^prescaler)) Hz, where the prescaler value is 3 bits wide. That is, a prescaler value of 0 through 7. The PWM duty cycle has 12 bits of resolution. If bit 12 of a PWM register is set, then the PWM output for that channel will be 100% high. Otherwise, the duty cycle setting is divided by 4096 to give the effective duty cycle. | ||
To give OUT5 a ~3 kHZ 50% duty cycle PWM output using ts8820ctl, the following arguments would be used: | To give OUT5 a ~3 kHZ 50% duty cycle PWM output using ts8820ctl, the following arguments would be used: | ||
<source lang=bash> | <source lang=bash> | ||
# - | # -P sets the PWM frequency via a prescaler value to (12207/(2^VALUE))Hz. | ||
# --mvolts= sets the PWM duty cycle percentage from a decimal scale of 0-10000 | # --mvolts= sets the PWM duty cycle percentage from a decimal scale of 0-10000 | ||
# --pwm= PWM channel to enable and modify | # --pwm= PWM channel to enable and modify | ||
ts8820ctl --pwm=5 --mvolts=5000 - | ts8820ctl --pwm=5 --mvolts=5000 -P 2 | ||
</source> | </source> |
Latest revision as of 17:16, 22 July 2019
The TS-8820 has 6 PWM outputs. PWM channels 1 to 6 feed digital outputs 1 to 6 respectively when the PWM override bit is set for a given output.
For all 8 PWM channels, the PWM frequency is approximately (12207/(2^prescaler)) Hz, where the prescaler value is 3 bits wide. That is, a prescaler value of 0 through 7. The PWM duty cycle has 12 bits of resolution. If bit 12 of a PWM register is set, then the PWM output for that channel will be 100% high. Otherwise, the duty cycle setting is divided by 4096 to give the effective duty cycle.
To give OUT5 a ~3 kHZ 50% duty cycle PWM output using ts8820ctl, the following arguments would be used:
# -P sets the PWM frequency via a prescaler value to (12207/(2^VALUE))Hz.
# --mvolts= sets the PWM duty cycle percentage from a decimal scale of 0-10000
# --pwm= PWM channel to enable and modify
ts8820ctl --pwm=5 --mvolts=5000 -P 2