GEX thesis source code, full text, references
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
\section { PWM Unit}
The \gls { PWM} unit uses a timer/counter to generate a \gls { PWM} (pulse train) signal. There are four outputs with a common frequency and independent duty cycles. Each channel can be individually enabled or disabled. This unit is intended for applications such as light dimming, heater regulation, or the control of H-bridges.
\subsection { PWM Configuration}
\begin { inicode}
[PWMDIM:pwm@12]
# Default pulse frequency (Hz)
frequency=1000
# Pin mapping - 0=disabled
# Channel1 - 1:PA6, 2:PB4, 3:PC6
ch1_ pin=1
# Channel2 - 1:PA7, 2:PB5, 3:PC7
ch2_ pin=0
# Channel3 - 1:PB0, 2:PC8
ch3_ pin=0
# Channel4 - 1:PB1, 2:PC9
ch4_ pin=0
\end { inicode}
\subsection { PWM Commands}
\begin { cmdlist}
0 & \cname { SET\_ FREQUENCY}
Set the PWM frequency
& \begin { cmdreq}
\cfield { u32} frequency in Hz
\end { cmdreq} \\
1 & \cname { SET\_ DUTY}
Set the duty cycle of one or more channels
& \begin { cmdreq}
\item Repeat 1--4 times:
\begin { pldlist}
\cfield { u8} channel number 0--3
\cfield { u16} duty cycle 0--1000
\end { pldlist}
\end { cmdreq} \\
2 & \cname { STOP}
Stop the hardware timer. Outputs enter low level.
& \\
3 & \cname { START}
Start the hardware timer.
& \\
\end { cmdlist}