You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
\fBpwmgen\fR is used to generate PWM (pulse width modulation) or
10
-
PDM (pulse density modulation) signals. The maximum PWM frequency
11
-
and the resolution is quite limited compared to hardware-based
12
-
approaches, but in many cases software PWM can be very useful.
13
-
If better performance is needed, a hardware PWM generator is a
14
-
better choice.
9
+
\fBpwmgen\fR is used to generate PWM (pulse width modulation) or PDM (pulse density modulation) signals.
10
+
The maximum PWM frequency and the resolution is quite limited compared to hardware-based approaches, but in many cases software PWM can be very useful.
11
+
If better performance is needed, a hardware PWM generator is a better choice.
15
12
.P
16
-
\fBpwmgen\fR supports a maximum of eight channels. The number of
17
-
channels actually loaded depends on the number of \fItype\fR values
18
-
given. The value of each \fItype\fR determines the outputs for that
19
-
channel.
13
+
\fBpwmgen\fR supports a maximum of eight channels.
14
+
The number of channels actually loaded depends on the number of \fItype\fR values given.
15
+
The value of each \fItype\fR determines the outputs for that channel.
20
16
.P
21
17
.TP
22
-
type 0: single output
23
-
A single output pin, \fBpwm\fR, whose duty cycle is determined by the
24
-
input value for positive inputs, and which is off (or at \fBmin\-dc\fR)
25
-
for negative inputs. Suitable for single ended circuits.
18
+
type 0: single output A single output pin, \fBpwm\fR, whose duty cycle is determined by the input value for positive inputs,
19
+
and which is off (or at \fBmin\-dc\fR) for negative inputs.
20
+
Suitable for single ended circuits.
26
21
.TP
27
22
type 1: pwm/direction
28
-
Two output pins, \fBpwm\fR and \fBdir\fR. The duty cycle on \fBpwm\fR
29
-
varies as a function of the input value. \fBdir\fR is low for positive
30
-
inputs and high for negative inputs.
23
+
Two output pins, \fBpwm\fR and \fBdir\fR. The duty cycle on \fBpwm\fR varies as a function of the input value.
24
+
\fBdir\fR is low for positive inputs and high for negative inputs.
31
25
.TP
32
26
type 2: up/down
33
-
Two output pins, \fBup\fR and \fBdown\fR. For positive inputs, the
34
-
PWM/PDM waveform appears on \fBup\fR, while \fBdown\fR is low. For
35
-
negative inputs, the waveform appears on \fBdown\fR, while \fBup\fR
36
-
is low. Suitable for driving the two sides of an H-bridge to generate
37
-
a bipolar output.
27
+
Two output pins, \fBup\fR and \fBdown\fR.
28
+
For positive inputs, the PWM/PDM waveform appears on \fBup\fR, while \fBdown\fR is low.
29
+
For negative inputs, the waveform appears on \fBdown\fR, while \fBup\fR is low.
30
+
Suitable for driving the two sides of an H-bridge to generate a bipolar output.
38
31
39
32
.SH FUNCTIONS
40
33
.TP
41
34
\fBpwmgen.make\-pulses\fR (no floating-point)
42
-
Generates the actual PWM waveforms, using information computed by
43
-
\fBupdate\fR. Must be called as frequently as possible, to maximize
44
-
the attainable PWM frequency and resolution, and minimize jitter.
35
+
Generates the actual PWM waveforms, using information computed by \fBupdate\fR.
36
+
Must be called as frequently as possible, to maximize the attainable PWM frequency and resolution, and minimize jitter.
45
37
Operates on all channels at once.
46
38
.TP
47
39
\fBpwmgen.update\fR (uses floating point)
48
-
Accepts an input value, performs scaling and limit checks, and converts
49
-
it into a form usable by \fBmake\-pulses\fR for PWM/PDM generation. Can
50
-
(and should) be called less frequently than \fBmake\-pulses\fR. Operates
51
-
on all channels at once.
40
+
Accepts an input value, performs scaling and limit checks, and converts it into a form usable by \fBmake\-pulses\fR for PWM/PDM generation.
41
+
Can (and should) be called less frequently than \fBmake\-pulses\fR.
42
+
Operates on all channels at once.
52
43
53
44
.SH PINS
54
45
.TP
@@ -91,12 +82,11 @@ regardless of the setting of \fBmin\-dc\fR.
91
82
.ns
92
83
.TP
93
84
\fBpwmgen.\fIN\fB.offset\fR float in/out
94
-
These parameters provide a scale and offset from the \fBvalue\fR pin to thewactual duty cycle.
85
+
These parameters provide a scale and offset from the \fBvalue\fR pin to the actual duty cycle.
95
86
The duty cycle is calculated according to \fIdc=(value/scale)+offset\fR, with 1.0 meaning 100%.
96
87
.TP
97
88
\fBpwmgen.\fIN\fB.pwm\-freq\fR float in/out
98
-
PWM frequency in Hz. The upper limit is half of the frequency at which \fBmake\-pulses\fR is invoked,
99
-
and values above that limit will be changed to the limit.
89
+
PWM frequency in Hz. The upper limit is half of the frequency at which \fBmake\-pulses\fR is invoked, and values above that limit will be changed to the limit.
100
90
If \fBdither\-pwm\fR is false, the value will be changed to the nearest integer submultiple of the \fBmake\-pulses\fR frequency.
101
91
A value of zero produces Pulse Density Modulation instead of Pulse Width Modulation.
0 commit comments