Jump to content

Component: LED Cube (Misc Circuit): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(5 intermediate revisions by the same user not shown)
Line 72: Line 72:


===Clear===
===Clear===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Clear'''
| width="90%" class="mtx-class-macrohead" | '''Clear'''
|-
|-
| colspan="2" | Clears the contents of the display to 0x0000  
| colspan="2" | Clears the contents of the display to 0x0000  
Line 91: Line 91:


===ConvColourToRGB===
===ConvColourToRGB===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ConvColourToRGB'''
| width="90%" class="mtx-class-macrohead" | '''ConvColourToRGB'''
|-
|-
| colspan="2" | Reads the individual RGB colour values from a single UINT colour value. Return Index: 0=Red, 1=Green, 2=Blue 
| colspan="2" | Reads the individual RGB colour values from a single UINT colour value. Return Index: 0=Red, 1=Green, 2=Blue 
Line 110: Line 110:


===ConvRGBToColour===
===ConvRGBToColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ConvRGBToColour'''
| width="90%" class="mtx-class-macrohead" | '''ConvRGBToColour'''
|-
|-
| colspan="2" | Converts RGB values into a single UINT colour parameter to use with other functions. 
| colspan="2" | Converts RGB values into a single UINT colour parameter to use with other functions. 
Line 139: Line 139:


===DisplayCharacter===
===DisplayCharacter===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DisplayCharacter'''
| width="90%" class="mtx-class-macrohead" | '''DisplayCharacter'''
|-
|-
| colspan="2" | This macro allows a character to be displayed on the screen 
| colspan="2" | This macro allows a character to be displayed on the screen 
Line 198: Line 198:


===DrawCuboid===
===DrawCuboid===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawCuboid'''
| width="90%" class="mtx-class-macrohead" | '''DrawCuboid'''
|-
|-
| colspan="2" | Draws a basic 3D cuboid onto the LEDs 
| colspan="2" | Draws a basic 3D cuboid onto the LEDs 
Line 257: Line 257:


===DrawLine===
===DrawLine===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawLine'''
| width="90%" class="mtx-class-macrohead" | '''DrawLine'''
|-
|-
| colspan="2" | Draws a basic 3D line onto the LEDs 
| colspan="2" | Draws a basic 3D line onto the LEDs 
Line 311: Line 311:


===GetColour===
===GetColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetColour'''
| width="90%" class="mtx-class-macrohead" | '''GetColour'''
|-
|-
| colspan="2" | Reads the colour value from a single pixel in the active buffer as a 16-bit value. Bits 0-4 = Red Bits 5-10 = Green Bits 11-15 = Blue 
| colspan="2" | Reads the colour value from a single pixel in the active buffer as a 16-bit value. Bits 0-4 = Red Bits 5-10 = Green Bits 11-15 = Blue 
Line 340: Line 340:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Sets up the data memory and draws the simulated LED cube on the panel. 
| colspan="2" | Sets up the data memory and draws the simulated LED cube on the panel. 
Line 354: Line 354:


===PWMTimer===
===PWMTimer===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PWMTimer'''
| width="90%" class="mtx-class-macrohead" | '''PWMTimer'''
|-
|-
| colspan="2" | Interrupt driven macro to clock out the signals to the LEDs in the cube. To be called as part of a high frequency hardware timer interrupt or software loop to drive the cube hardware, Min Frequency = 60(Hz) * 8(Height) * 32(5-bitColourChannelValue) 
| colspan="2" | Interrupt driven macro to clock out the signals to the LEDs in the cube. To be called as part of a high frequency hardware timer interrupt or software loop to drive the cube hardware, Min Frequency = 60(Hz) * 8(Height) * 32(5-bitColourChannelValue) 
Line 368: Line 368:


===ResetRotations===
===ResetRotations===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ResetRotations'''
| width="90%" class="mtx-class-macrohead" | '''ResetRotations'''
|-
|-
| colspan="2" | Resets the rotation count variables allowing for a new rotation to be started 
| colspan="2" | Resets the rotation count variables allowing for a new rotation to be started 
Line 382: Line 382:


===RotateDisplay===
===RotateDisplay===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RotateDisplay'''
| width="90%" class="mtx-class-macrohead" | '''RotateDisplay'''
|-
|-
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
Line 416: Line 416:


===RotateShellXY===
===RotateShellXY===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RotateShellXY'''
| width="90%" class="mtx-class-macrohead" | '''RotateShellXY'''
|-
|-
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
Line 440: Line 440:


===RotateShellXZ===
===RotateShellXZ===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RotateShellXZ'''
| width="90%" class="mtx-class-macrohead" | '''RotateShellXZ'''
|-
|-
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
Line 464: Line 464:


===RotateShellYZ===
===RotateShellYZ===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RotateShellYZ'''
| width="90%" class="mtx-class-macrohead" | '''RotateShellYZ'''
|-
|-
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
Line 488: Line 488:


===SetColour===
===SetColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetColour'''
| width="90%" class="mtx-class-macrohead" | '''SetColour'''
|-
|-
| colspan="2" | Sets a pixel colour in the none active buffer using a 16-bit colour value Bits 0-4 = Red Bits 5-10 = Green Bits 11-15 = Blue 
| colspan="2" | Sets a pixel colour in the none active buffer using a 16-bit colour value Bits 0-4 = Red Bits 5-10 = Green Bits 11-15 = Blue 
Line 522: Line 522:


===ShiftDisplay===
===ShiftDisplay===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftDisplay'''
| width="90%" class="mtx-class-macrohead" | '''ShiftDisplay'''
|-
|-
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
| colspan="2" | Shifts the contents of the display by the number of vertices specified 
Line 561: Line 561:


===SwitchBuffers===
===SwitchBuffers===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SwitchBuffers'''
| width="90%" class="mtx-class-macrohead" | '''SwitchBuffers'''
|-
|-
| colspan="2" | Switches the current display buffer to the updated buffer to allow for seamless updates when undergoing heavy calcaulations. 
| colspan="2" | Switches the current display buffer to the updated buffer to allow for seamless updates when undergoing heavy calcaulations. 
Line 581: Line 581:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | LEDs
| width="90%" class="mtx-class-propfolder" | LEDs
|-
|-
|-
|-
Line 636: Line 636:
| colspan="2" | Number of micro seconds to wait between switching off the driver and clocking out the new signals. Used to remove any ghosting effects visible on the display due to slow driver switch off times. 
| colspan="2" | Number of micro seconds to wait between switching off the driver and clocking out the new signals. Used to remove any ghosting effects visible on the display due to slow driver switch off times. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| width="90%" class="mtx-class-propfolder" | Connections
|-
|-
|-
|-
Line 655: Line 655:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-

Latest revision as of 14:36, 13 July 2026

Author Ben Rowland 2014
Version 1.0
Category Misc Circuit


LED Cube component

LED Cube component for driving 3D arrays of LEDs. A typical cube could consist of 4x4x4 or 8x8x8 but does not necessarily need to be a cuboid.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_LEDCUBE.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_LEDCUBE.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples







Macro reference

Clear

Clear
Clears the contents of the display to 0x0000  
- BYTE SwitchBuffers
0=DoNotSwitch 1=SwitchAutomaticallyWhenDone 
- VOID Return


ConvColourToRGB

ConvColourToRGB
Reads the individual RGB colour values from a single UINT colour value. Return Index: 0=Red, 1=Green, 2=Blue 
- UINT Colour
 
- STRING Return


ConvRGBToColour

ConvRGBToColour
Converts RGB values into a single UINT colour parameter to use with other functions. 
- BYTE Red
 
- BYTE Green
 
- BYTE Blue
 
- UINT Return


DisplayCharacter

DisplayCharacter
This macro allows a character to be displayed on the screen 
- BYTE Character
 
- BYTE X1
X pixel coordinate to set the output string position. 
- BYTE Y1
Y pixel coordinate to set the output string position. 
- BYTE Z1
 
- BYTE Font
Size of the font - 0 = Normal, 1 = Double Width, 2 = Double Width and Height, 3 = Double Height 
- BYTE Axis
0=XY, 1=XZ, 2=YZ 
- BYTE Orientation
0=Normal, 1=HFlip. 2=VFlip, 3=HFlip & VFlip 
- UINT Colour
Specifies the foreground colour 
- BYTE SwitchBuffers
 
- VOID Return


DrawCuboid

DrawCuboid
Draws a basic 3D cuboid onto the LEDs 
- BYTE X1
 
- BYTE Y1
 
- BYTE Z1
 
- BYTE X2
 
- BYTE Y2
 
- BYTE Z2
 
- BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
- UINT Colour
 
- BYTE SwitchBuffers
 
- VOID Return


DrawLine

DrawLine
Draws a basic 3D line onto the LEDs 
- BYTE X1
 
- BYTE Y1
 
- BYTE Z1
 
- BYTE X2
 
- BYTE Y2
 
- BYTE Z2
 
- UINT Colour
 
- BYTE SwitchBuffers
 
- VOID Return


GetColour

GetColour
Reads the colour value from a single pixel in the active buffer as a 16-bit value. Bits 0-4 = Red Bits 5-10 = Green Bits 11-15 = Blue 
- BYTE X
 
- BYTE Y
 
- BYTE Z
 
- UINT Return


Initialise

Initialise
Sets up the data memory and draws the simulated LED cube on the panel. 
- VOID Return


PWMTimer

PWMTimer
Interrupt driven macro to clock out the signals to the LEDs in the cube. To be called as part of a high frequency hardware timer interrupt or software loop to drive the cube hardware, Min Frequency = 60(Hz) * 8(Height) * 32(5-bitColourChannelValue) 
- VOID Return


ResetRotations

ResetRotations
Resets the rotation count variables allowing for a new rotation to be started 
- VOID Return


RotateDisplay

RotateDisplay
Shifts the contents of the display by the number of vertices specified 
- INT X
Number of pixels to shift the display -7 to 7 
- INT Y
Number of pixels to shift the display -7 to 7 
- INT Z
Number of pixels to shift the display -7 to 7 
- BYTE SwitchBuffers
 
- VOID Return


RotateShellXY

RotateShellXY
Shifts the contents of the display by the number of vertices specified 
- BYTE Direction
 
- BYTE Shell
 
- VOID Return


RotateShellXZ

RotateShellXZ
Shifts the contents of the display by the number of vertices specified 
- BYTE Direction
 
- BYTE Shell
 
- VOID Return


RotateShellYZ

RotateShellYZ
Shifts the contents of the display by the number of vertices specified 
- BYTE Direction
 
- BYTE Shell
 
- VOID Return


SetColour

SetColour
Sets a pixel colour in the none active buffer using a 16-bit colour value Bits 0-4 = Red Bits 5-10 = Green Bits 11-15 = Blue 
- BYTE X
 
- BYTE Y
 
- BYTE Z
 
- UINT Colour
16-bit Colour Value (MSB B5, G6, R5 LSB) 
- VOID Return


ShiftDisplay

ShiftDisplay
Shifts the contents of the display by the number of vertices specified 
- INT X
Number of pixels to shift the display -7 to 7 
- INT Y
Number of pixels to shift the display -7 to 7 
- INT Z
Number of pixels to shift the display -7 to 7 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- BYTE SwitchBuffers
 
- VOID Return


SwitchBuffers

SwitchBuffers
Switches the current display buffer to the updated buffer to allow for seamless updates when undergoing heavy calcaulations. 
- BYTE WaitForSwitch
0=DoNotWait, 1=Waits for switch to occur 
- VOID Return


Property reference

Properties
LEDs
Width (X)
The number of LEDs wide 
Depth (Y)
The number of LEDs deep 
Height (Z)
The number of LEDs tall 
LED Count
Number of LEDs required by the component 
LED Type
 
Common Type
 
Wiring Order
Specifies the order of the wiring of the LEDs from lowest bit to highest 
Driver Pre Delay
Number of micro seconds to wait between switching off the driver and clocking out the new signals. Used to remove any ghosting effects visible on the display due to slow driver switch off times. 
Driver Post Delay
Number of micro seconds to wait between switching off the driver and clocking out the new signals. Used to remove any ghosting effects visible on the display due to slow driver switch off times. 
Connections
Clock Pin
 
Data Port
 
Enable Port
 
Simulation
LED Size
Size of each LED on the panel  
Spacing
Number of units of spacing between each LED 
Transparent
If set to yes then a LED which is completely switched off will be set to transparent, If set to no then the LED will be shown as black. 
Toggle Pins
Determines if the pins are toggled as part of the PWMTimer macro during simulation. During simulation you probably don't want the pins toggling as it will slow down simulation. The only exception may be if you want to see the signals in the scope window. Does not effect the compiled embedded code.