Demand Peripherals     Robotics and Automation Made Easy

PWMOUT4: Quad Pulse Width Modulated Output

PWMOUT4 gives you four channels of 12 bit PWM output. You can set the PWM counter to one of eight different frequencies. When used with the quad open-drain driver card the PWMOUT4 peripheral can control the speed of four DC motors or the brightness of four strings of LEDs.



The PWMOUT4 peripheral puts a PWM output on four FPGA pins. Each PWM output can be on from 0 to 4096 counts of the PWM clock. The outputs are not synchronized in any way. That is, one output might, or might not, start at the same time as another output. Typically, the outputs all start at different times but there is no guarantee of this. The PWM total period is always 4096 counts long.

PWMOUT4 works with any of the following cards:
     GPIO with pin headers
     GPIO with screw terminals
     Open-Drain Driver Card



pwm : PWM pulse widths as four 12-bit hex numbers.
The pulse widths are separated by spaces and terminated by a newline. Each of the four pulse widths can vary between 000 and fff.

config : clock rate in Hertz. This is the frequency at which the PWM counter is incremented. Valid frequencies include: 20 MHz, 10 MHz, 2 MHz, 1 MHz, 500 KHz, 200 KHz, 100 KHz, and 0. A clock frequency of zero turns off all PWM outputs. The frequency of the PWM pulses is config frequency divided by 4096. This resouce works with dpset and dpget.

phase : start/stop times for each PWM channel.
This read-only resource shows the start count and end count for each PWM channel. The output is start/stop followed by a space. A dash is used where there is no start or stop times, i.e. when the duty cycle is either 0 or 100 percent. It is possible for a pulse to wrap from then end of the 4096 cycle to the start. When this happens the stop count will be smaller than the start count. As an example, the output of this resource might appear as:

    100/2ff 0/381 0/- 200/0fc



Set the MSB to 100 percent, the next lower MSB to 50 percent, and the two LSBs to 0 percent. Set the PWM counter frequency to 10 MHz.

    dpset pwmout4 pwm 3ff 1ff 0 0
    dpset pwmout4 config 10000000


FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
Tone Generator
IR Recv/Xmit
6 Digit LCD
RC Decoder
Keyfob RF Decoder
Rotary Encoder Interface
Quad Touch Interface
Motion Control
Dual DC Motor Controller
Dual Quadrature Decoder
Quad 13 Bit Servo
Bipolar Stepper Controller
Unipolar Stepper Controller
Simple Input / Output
Quad Binary Output
Quad Binary Input
Octal Input/Output
32 Channel Binary Output
32 Channel Binary Input
Octal 12-bit ADC
Quad Ping))) Interface
Octal SRF04 Interface
Quad Event Counter
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
4 Bit Pattern Generator
Real Time Clock
Dual Watchdog Timers

Interface Cards
User Interface
Audio Amplifier
IR Recv/xmit
Six Digit LCD Display
Keyfob RF Receiver
Rotary Encoder
Quad Switch Card
Text LCD / keypad
Quad Slide Pot
Quad Touch Interface
Motion Control
Dual 7-amp H-bridge
Quad Open Drain Driver
Quad 10 Amp Relay Card
Input / Output
Octal 8-Bit DAC
Quad Digital Potentiometer
Octal 12-bit ADC
Octal SRF04
Generic I2C
Generic SPI
USB 2.0 Hub
Real Time Clock
Slot Expander
Octal Input/Output
32 Channel Input
32 Channel Output
Power Distribution Card
15 Amp Power Distribution
5 Volt Switching Regulator
ATX Power Break-Out Card
Disk Drive Power Break-Out
MP43 Aluminum Mounting Plate
WW2 Prototyping Card
WW1 Small Prototyping Card