skip navigational linksPJRC
Shopping Cart Download Website
Home Products Teensy Blog Forum
You are here: Teensy Teensyduino Libraries ShiftPWM

PJRC Store
Teensy 4.1, $28.60
Teensy 4.0, $22.80
Teensy LC, $12.85
Main Page
Getting Started
How-To Tips
Code Library

ShiftPWM Library

ShiftPWM, by Elco Jacobs, creates many PWM outputs using only 3 signals and inexpensive shift register chips.

Download: Included with the Teensyduino Installer
Latest Developments on Github

Hardware Requirements

ShiftPWM Test Board, CAD Files Below

ShiftPWM uses only 3 signals to drive any number of shift register chips.

SignalTeensy 2.0Teensy++ 2.0Teensy LC & 3.x74VHC595

On Teensy LC, 3.0, 3.1, 3.2, 3.5, 3.6, SHIFTPWM_NOSPI must be defined. See the examples in File > Examples > ShiftPWM for details.

Example Program

The example code can be opened from the menu:

   File > Examples > ShiftPWM > ShiftPWM_RGB_Example

CPU & On-Chip Resource Usage

ShifPWM uses timer1 and the SPI port to rapidly shift new data to all the pins. This consumes a large amount of CPU time. The ShiftPWM.PrintInterruptLoad() function gives information about how much CPU time is used.

ShifPWM lets you configure the number of 8 bit registers, and the number of PWM levels. As more registers are used and more levels are supported, more data must be shifted, which slows the refresh rate. These settings should be adjusted to for a good, flicker-free refresh rate.

Test Circuit Board

These Circuit Board CAD Files were fabricated by Laen's PCB Group Order.

More Details

Please refer to the official ShiftPWM documentation for more details.