
This design implements a UART-controlled PWM generator.
A UART receiver listens on ui_in[0] using a standard 8N1 protocol.
The system uses a simple two-byte command format:
Internally, a small state machine processes these bytes and updates the corresponding duty register.
A shared 8-bit counter continuously increments from 0 to 255. Each PWM output compares this counter with its duty value:
counter < duty, output is HIGHThis generates seven independent PWM signals simultaneously.
Whenever a byte is received, the UART transmitter sends back 0xAA
as an acknowledgment.
Connect a UART source to ui_in[0]
Set ui_in[1] = 1 to enable the design
Apply reset using rst_n
Send two bytes:
[CHANNEL][DUTY]
Examples:
0x00 0x00 → PWM0 OFF0x01 0xFF → PWM1 FULL ON0x02 0x80 → PWM2 ~50% dutyObserve outputs on uo_out[6:0].
Expected output: PWM signals with duty cycles matching the received values.
No additional hardware is required.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | UART RX | PWM0 | |
| 1 | Enable | PWM1 | |
| 2 | PWM2 | ||
| 3 | PWM3 | ||
| 4 | PWM4 | ||
| 5 | PWM5 | ||
| 6 | PWM6 | ||
| 7 | UART TX |