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 hex numbers.
Specify the PWM duty cycles as hex numbers in the range of 0 to 1000. A value of 800 is fifty percent duty cycle. The maximum is 1000 (100% on) and the minimum is 0 (entirely off).
The pulse widths are separated by spaces and terminated by a newline. Each of the four pulse widths can vary between 000 and 1000.

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 resource works with dpset and dpget.

The config frequency must be one of the following:
   2000000 -- 2 MHz
   1000000 -- 1 MHz
    500000 -- 500 KHz
    100000 -- 100 KHz
     50000 --  50 KHz
     10000 --  10 KHz
      5000 --   5 KHz
      1000 --   1 KHz
       500 -- 500 Hz
       100 -- 100 Hz
        50 --  50 Hz



Set the PWM counter frequency to 10 MHz. Set the PWM duty cycles to 25, 50, 75, and 100 percent. percent, and the two LSBs to 0 percent.

    # Set the PWM clock to 20 MHz
    dpset pwmout4 config 20000000
    # Set the PWM duty cycles to 25, 50, 75 and 100 percent
    dpset pwmout4 pwms 400 800 c00 1000


FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Host Tx/Rx Interface
AVR Interface
Stereo Audio Amplifier
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
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
Quad Serial Output
Octal Serial Output
Octal 12-bit ADC
Quad Ping))) Interface
Pololu QTR Interface
Octal SRF04 Interface
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
Quad Event Counter
Real Time Clock
Dual Pulse Generator

Interface Cards
Control Cards
User Interface
Stereo 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
I2C Prototyping
SPI Prototyping
USB 2.0 Hub
Real Time Clock
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
WW4 Large Prototyping Card
WW2 Prototyping Card
WW1 Small Prototyping Card
SMP SMD Prototyping Card