TS-8820-pwm-new

From Technologic Systems Manuals


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.

When using ts8820ctl, the duty can be passed on a scale from 0-1000 which directly corresponds to 0-100%.

To give OUT5 a ~3 kHz 50% duty cycle PWM output using ts8820ctl, the following arguments would be used:

# --prescaler= sets the PWM frequency via a prescaler value to (12207/(2^VALUE))Hz.
# --duty= sets the PWM duty cycle percentage from a decimal scale of 0-1000
# --pwm= PWM channel to enable and modify (1-6)
ts8820ctl --pwm=5 --duty=500 --prescaler=2