Difference between revisions of "Component: PWM 16CH 12Bit (PCA9685) (General Output)"
From Flowcode Help
Jump to navigationJump to search (XML import) |
|||
Line 1: | Line 1: | ||
− | + | {| style="width:50%" | |
− | {| | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Author | + | | width="20%" style="color:gray;" | Author |
| Matrix TSL | | Matrix TSL | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Version | + | | width="20%" style="color:gray;" | Version |
− | | 1.0 | + | | 1.0 |
|- | |- | ||
− | | width="20%" style="color: gray;" | Category | + | | width="20%" style="color:gray;" | Category |
| General Output | | General Output | ||
|} | |} | ||
+ | ==PWM 16CH 12Bit (PCA9685) component== | ||
+ | The PCA9685 is an I²C-bus controlled 16-channel LED controller optimized for Red/Green/Blue/Amber (RGBA) color backlighting or Servo motor applications. Each output has its own 12-bit resolution (4096 steps) fixed frequency individual PWM controller that operates at a programmable frequency from a typical of 24 Hz to 1526 Hz. All outputs are set to the same PWM frequency. Up to 64 devices can be chained together on a single I²C-bus to provide up to 1024 individual PWM outputs. | ||
− | == | + | ==Detailed description== |
− | + | ||
− | + | ''No detailed description exists yet for this component'' | |
− | |||
− | |||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
''<span style="color:red;">No additional examples</span>'' | ''<span style="color:red;">No additional examples</span>'' | ||
Line 26: | Line 27: | ||
==Downloadable macro reference== | ==Downloadable macro reference== | ||
− | === | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
− | Sends a reset command to the PCA9685 chip over I2C | + | |- |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Reset''' | ||
+ | |- | ||
+ | | colspan="2" | Sends a reset command to the PCA9685 chip over I2C | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | :'' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetPWMFrequency''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the PWM frequency for the entire chip, up to approx 1.6 KHz | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:]] - | ||
+ | | width="90%" | Frequency | ||
+ | |- | ||
+ | | colspan="2" | Floating point frequency that we will attempt to match | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | '''Return | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetOutputMode''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the output mode of the PCA9685 to either open drain or push pull. Warning: LEDs with integrated zener diodes should only be driven in open drain mode. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:]] - | ||
+ | | width="90%" | Mode | ||
+ | |- | ||
+ | | colspan="2" | 0=OpenDrain, 1=Push/Pull | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Sleep''' | ||
+ | |- | ||
+ | | colspan="2" | Puts the module into Sleep mode | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | ''' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetExternalClock''' | ||
+ | |- | ||
+ | | colspan="2" | Sets EXTCLK pin to use the external clock | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Prescale | ||
+ | |- | ||
+ | | colspan="2" | External Clock Prescaler - Range: 3-255 | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetAddress''' | ||
+ | |- | ||
+ | | colspan="2" | Allows a different I2C address to be specified allowing one component to control multiple PCA9685 modules. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Address | ||
+ | |- | ||
+ | | colspan="2" | Range: 0x40 - 0x7F | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | :'' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetClockFrequency''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the current clock frequency, used for things like calculating the PWM frequency and Microsecond duty. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" | Clock | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | === | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
− | + | |- | |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetClockFrequency''' | ||
+ | |- | ||
+ | | colspan="2" | Returns the current clock frequency | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | ''' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteMicroseconds''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the PWM output of one of the PCA9685 pins based on the input microseconds, output is not precise | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Output | ||
+ | |- | ||
+ | | colspan="2" | One of the PWM output pins - Range: 0 to 15 | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Microseconds | ||
+ | |- | ||
+ | | colspan="2" | The number of Microseconds to turn the PWM output ON | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetPWM''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the PWM output of one of the PCA9685 pins | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Output | ||
+ | |- | ||
+ | | colspan="2" | One of the PWM output pins - Range: 0 to 15 | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | On | ||
+ | |- | ||
+ | | colspan="2" | At what point in the 4096-part cycle to turn the PWM output ON | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Off | ||
+ | |- | ||
+ | | colspan="2" | At what point in the 4096-part cycle to turn the PWM output OFF | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | :'' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | ||
+ | |- | ||
+ | | colspan="2" | Sets up the I2C ready for communications to begin | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | === | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
− | + | |- | |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WakeUp''' | ||
+ | |- | ||
+ | | colspan="2" | Wakes the module from Sleep mode | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | :'' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetPin''' | ||
+ | |- | ||
+ | | colspan="2" | Sets pin without having to deal with on/off tick placement and properly handles a zero value as completely off and 4095 as completely on. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Output | ||
+ | |- | ||
+ | | colspan="2" | One of the PWM output pins - Range: 0 to 15 | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Duty | ||
+ | |- | ||
+ | | colspan="2" | The number of ticks out of 4096 to be active | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:]] - | ||
+ | | width="90%" | Invert | ||
+ | |- | ||
+ | | colspan="2" | 0=Normal, 1=Inverted | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | '''Return | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawRectangle2D''' | ||
+ | |- | ||
+ | | colspan="2" | Draws a basic 2D rectangle onto the LEDs | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | X1 | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Y1 | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | X2 | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Y2 | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | DrawStyle | ||
+ | |- | ||
+ | | colspan="2" | Sets the draw style - 0=Soild, 1=Edge, 2=Corners | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | R | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | G | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | B | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftLEDs2D''' | ||
+ | |- | ||
+ | | colspan="2" | Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:]] - | ||
+ | | width="90%" | X | ||
+ | |- | ||
+ | | colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:]] - | ||
+ | | width="90%" | Y | ||
+ | |- | ||
+ | | colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | DataMode | ||
+ | |- | ||
+ | | colspan="2" | 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | ''' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLEDIndex3D''' | ||
+ | |- | ||
+ | | colspan="2" | Gets the index of a single LED in RAM as a 3D array. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | X | ||
+ | |- | ||
+ | | colspan="2" | LED Column to change the colour / Range: 0 to (LED Column - 1) | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Y | ||
+ | |- | ||
+ | | colspan="2" | LED Row to change the colour / Range: 0 to (LED Row - 1) | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Z | ||
+ | |- | ||
+ | | colspan="2" | LED Layer to change the colour / Range: 0 to (LED Layer - 1) | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawCuboid3D''' | ||
+ | |- | ||
+ | | colspan="2" | Draws a basic 3D cuboid onto the LEDs | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | X1 | ||
+ | |- | ||
+ | | colspan="2" | Start X pixel coordinate | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Y1 | ||
+ | |- | ||
+ | | colspan="2" | Start Y pixel coordinate | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Z1 | ||
+ | |- | ||
+ | | colspan="2" | Start Z pixel coordinate | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | X2 | ||
+ | |- | ||
+ | | colspan="2" | End X pixel coordinate | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Y2 | ||
+ | |- | ||
+ | | colspan="2" | End Y pixel coordinate | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Z2 | ||
+ | |- | ||
+ | | colspan="2" | End Z pixel coordinate | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | DrawStyle | ||
+ | |- | ||
+ | | colspan="2" | Sets the draw style - 0=Soild, 1=Edge, 2=Corners | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | R | ||
+ | |- | ||
+ | | colspan="2" | Red Colour Channel | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | G | ||
+ | |- | ||
+ | | colspan="2" | Green Colour Channel | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | B | ||
+ | |- | ||
+ | | colspan="2" | White Colour Channel | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | :'' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | ||
+ | |- | ||
+ | | colspan="2" | Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to initialise all the LED ICs in the chain. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | === | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
− | + | |- | |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftLEDs3D''' | ||
+ | |- | ||
+ | | colspan="2" | Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:]] - | ||
+ | | width="90%" | X | ||
+ | |- | ||
+ | | colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:]] - | ||
+ | | width="90%" | Y | ||
+ | |- | ||
+ | | colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:]] - | ||
+ | | width="90%" | Z | ||
+ | |- | ||
+ | | colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | DataMode | ||
+ | |- | ||
+ | | colspan="2" | 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | ||
+ | |- | ||
+ | | colspan="2" | Sets up the data memory and draws the simulated LED cube on the panel. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Property reference== | ==Property reference== | ||
− | |||
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | + | |- | |
− | Module I2C Address. | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | |
− | This setting can be overridden using the SetAddress component macro. | + | |- |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Address | |
− | + | |- | |
− | + | | colspan="2" | Module I2C Address. This setting can be overridden using the SetAddress component macro. | |
− | Sets the output mode of the PCA9685 to either open drain or push pull. | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | Warning: LEDs with integrated zener diodes should only be driven in open drain mode. | + | | width="90%" | Output Mode |
− | + | |- | |
− | Can be overridden using the SetOutputMode component macro. | + | | colspan="2" | Sets the output mode of the PCA9685 to either open drain or push pull. Warning: LEDs with integrated zener diodes should only be driven in open drain mode. Can be overridden using the SetOutputMode component macro. |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Clock Type | |
− | + | |- | |
− | + | | colspan="2" | Configures the input clock source to the module. | |
− | Configures the input clock source to the module. | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |
− | + | | width="90%" | Clock Frequency | |
− | + | |- | |
− | + | | colspan="2" | Frequency of the module. Internal oscillator defaults to 250000000 or 25MHz but can actually be anywhere from 23 to 27MHz. External clock frequency can be specified here up to a max value of 50000000 or 50MHz. This setting can be overridden using the SetClockFrequency component macro. | |
− | + | |- | |
− | Frequency of the module. | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] |
− | + | | width="90%" | Prescaler | |
− | Internal oscillator defaults to 250000000 or 25MHz but can actually be anywhere from 23 to 27MHz. | + | |- |
− | + | | colspan="2" | External Clock Prescaler Range: 3 to 255 | |
− | External clock frequency can be specified here up to a max value of 50000000 or 50MHz. | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | |
− | This setting can be overridden using the SetClockFrequency component macro. | + | | width="90%" | Target PWM Frequency |
− | + | |- | |
− | + | | colspan="2" | The ideal PWM frequency we would like to generate on the output pins. Servo motors require an output frequency around 50Hz. LEDs require a mugh higher output frequency to avoid visible flicker. | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | |
− | + | | width="90%" | Actual PWM Frequency | |
− | External Clock Prescaler | + | |- |
− | + | | colspan="2" | The calculated actual PWM frequency available using the Clock Frequency and Prescaler | |
− | Range: 3 to 255 | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | |
− | + | | width="90%" | PWM Resolution | |
− | + | |- | |
− | + | | colspan="2" | Number of microseconds the PWM output can resolve to | |
− | + | |- | |
− | The ideal PWM frequency we would like to generate on the output pins. | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] |
− | + | | width="90%" | Channel | |
− | Servo motors require an output frequency around 50Hz. | + | |- |
− | + | | colspan="2" | Channel selection | |
− | LEDs require a mugh higher output frequency to avoid visible flicker. | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Baud Select | |
− | + | |- | |
− | + | | colspan="2" | Baud rate option selector | |
− | + | |- | |
− | The calculated actual PWM frequency available using the Clock Frequency and Prescaler | + | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] |
− | + | | width="90%" | Baud Rate | |
− | + | |- | |
− | + | | colspan="2" | Baud rate to be used | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |
− | Number of microseconds the PWM output can resolve to | + | | width="90%" | SDA |
− | + | |- | |
− | + | | colspan="2" | Pin used for SDA (data signal) | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |
− | + | | width="90%" | SCL | |
− | Channel selection | + | |- |
− | + | | colspan="2" | Pin used for SCL (clock signal) | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | |
− | + | | width="90%" | Stop Delay | |
− | + | |- | |
− | Baud rate option selector | + | | colspan="2" | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications. |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | |
− | + | | width="90%" | Scope Traces | |
− | + | |- | |
− | + | | colspan="2" | Selects if the component pin connections are automatically generated on the data recorder window or not. Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion. No: Do not show the pin signals on the data recorder window. | |
− | Baud rate to be used | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | |
− | + | | width="90%" | Console Data | |
− | + | |- | |
− | + | | colspan="2" | Selects if the console data is automatically generated or not | |
− | + | |- | |
− | Pin used for SDA (data signal) | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] |
− | + | | width="90%" | API | |
− | + | |- | |
− | + | | colspan="2" | Specifies the API component on the panel to interact with to provide comms simulation. | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]] | |
− | Pin used for SCL (clock signal) | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections''' |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]] | |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations''' | |
− | + | |- | |
− | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | |
− | a 10ms delay between an I2C stop event and the next I2C start event. | + | | width="90%" | Simulate Comms |
− | + | |- | |
− | + | | colspan="2" | | |
− | + | |} | |
− | Most modern microcontrollers will not have a problem so this property can be disabled to speed up the | ||
− | |||
− | I2C communications. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | Selects if the component pin connections are automatically generated on the data recorder window or not. | ||
− | |||
− | Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion. | ||
− | |||
− | No: Do not show the pin signals on the data recorder window. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | Selects if the console data is automatically generated or not | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | Specifies the API component on the panel to interact with to provide comms simulation. |
Revision as of 21:07, 16 November 2021
Author | Matrix TSL |
Version | 1.0 |
Category | General Output |
Contents
PWM 16CH 12Bit (PCA9685) component
The PCA9685 is an I²C-bus controlled 16-channel LED controller optimized for Red/Green/Blue/Amber (RGBA) color backlighting or Servo motor applications. Each output has its own 12-bit resolution (4096 steps) fixed frequency individual PWM controller that operates at a programmable frequency from a typical of 24 Hz to 1526 Hz. All outputs are set to the same PWM frequency. Up to 64 devices can be chained together on a single I²C-bus to provide up to 1024 individual PWM outputs.
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Downloadable macro reference
![]() |
Reset |
Sends a reset command to the PCA9685 chip over I2C | |
![]() |
Return |
![]() |
SetPWMFrequency |
Sets the PWM frequency for the entire chip, up to approx 1.6 KHz | |
[[File:]] - | Frequency |
Floating point frequency that we will attempt to match | |
![]() |
Return |
![]() |
Sleep |
Puts the module into Sleep mode | |
![]() |
Return |
![]() |
SetExternalClock |
Sets EXTCLK pin to use the external clock | |
![]() |
Prescale |
External Clock Prescaler - Range: 3-255 | |
![]() |
Return |
![]() |
SetAddress |
Allows a different I2C address to be specified allowing one component to control multiple PCA9685 modules. | |
![]() |
Address |
Range: 0x40 - 0x7F | |
![]() |
Return |
![]() |
SetClockFrequency |
Sets the current clock frequency, used for things like calculating the PWM frequency and Microsecond duty. | |
![]() |
Clock |
![]() |
Return |
![]() |
GetClockFrequency |
Returns the current clock frequency | |
![]() |
Return |
![]() |
Initialise |
Sets up the I2C ready for communications to begin | |
![]() |
Return |
![]() |
WakeUp |
Wakes the module from Sleep mode | |
![]() |
Return |
![]() |
Initialise |
Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to initialise all the LED ICs in the chain. | |
![]() |
Return |
![]() |
Initialise |
Sets up the data memory and draws the simulated LED cube on the panel. | |
![]() |
Return |