Difference between revisions of "Component: LED WS2801 (Outputs: LEDs)"

From Flowcode Help
Jump to navigationJump to search
(Created page with "{| width="50%" |- | width="20%" style="color: gray;" | Author | Matrix TSL |- | width="20%" style="color: gray;" | Version | ...")
 
Line 1: Line 1:
{| width="50%"
+
{| 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 (Release)
 
| 1.0 (Release)
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color: gray;" | Category
 
| Outputs: LEDs
 
| Outputs: LEDs
 
|}
 
|}
Line 20: Line 20:
  
 
==Examples==
 
==Examples==
''<span style="color:red;">No additional examples</span>''
+
''<span style="color:red;">No additional examples</span>''
  
  
 
==Downloadable macro reference==
 
==Downloadable macro reference==
  
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;DrawLine2D&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
+
===<span style="font-weight: normal;"><u><tt>DrawLine2D</tt></u></span>===
 
Draws a line on a 2D array of LEDs
 
Draws a line on a 2D array of LEDs
  
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
+
'''Parameters'''
  
:[[Variable Types|UINT]] &apos;&apos;X1&apos;&apos;
+
:[[Variable Types|UINT]] ''X1''
  
:[[Variable Types|UINT]] &apos;&apos;Y1&apos;&apos;
+
:[[Variable Types|UINT]] ''Y1''
  
:[[Variable Types|UINT]] &apos;&apos;X2&apos;&apos;
+
:[[Variable Types|UINT]] ''X2''
  
:[[Variable Types|UINT]] &apos;&apos;Y2&apos;&apos;
+
:[[Variable Types|UINT]] ''Y2''
  
:[[Variable Types|BYTE]] &apos;&apos;R&apos;&apos;
+
:[[Variable Types|BYTE]] ''R''
  
:[[Variable Types|BYTE]] &apos;&apos;G&apos;&apos;
+
:[[Variable Types|BYTE]] ''G''
  
:[[Variable Types|BYTE]] &apos;&apos;B&apos;&apos;
+
:[[Variable Types|BYTE]] ''B''
  
  
&apos;&apos;&apos;Return value&apos;&apos;&apos;
+
'''Return value'''
  
:&apos;&apos;This call does not return a value&apos;&apos;
+
:''This call does not return a value''
  
  
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;SetAllLEDColour&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
+
===<span style="font-weight: normal;"><u><tt>SetAllLEDColour</tt></u></span>===
 
Sets the colour of all the LEDs in RAM
 
Sets the colour of all the LEDs in RAM
  
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
+
'''Parameters'''
  
:[[Variable Types|BYTE]] &apos;&apos;R&apos;&apos;
+
:[[Variable Types|BYTE]] ''R''
  
:[[Variable Types|BYTE]] &apos;&apos;G&apos;&apos;
+
:[[Variable Types|BYTE]] ''G''
  
:[[Variable Types|BYTE]] &apos;&apos;B&apos;&apos;
+
:[[Variable Types|BYTE]] ''B''
  
  
&apos;&apos;&apos;Return value&apos;&apos;&apos;
+
'''Return value'''
  
:&apos;&apos;This call does not return a value&apos;&apos;
+
:''This call does not return a value''
  
  
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;SetLEDColour&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
+
===<span style="font-weight: normal;"><u><tt>SetLEDColour</tt></u></span>===
 
Sets the colour of a single LED in RAM as a 1D array.
 
Sets the colour of a single LED in RAM as a 1D array.
  
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
+
'''Parameters'''
  
:[[Variable Types|UINT]] &apos;&apos;LED&apos;&apos;
+
:[[Variable Types|UINT]] ''LED''
 
::LED to change the colour / Range: 0 to (LED Count - 1)
 
::LED to change the colour / Range: 0 to (LED Count - 1)
  
:[[Variable Types|BYTE]] &apos;&apos;R&apos;&apos;
+
:[[Variable Types|BYTE]] ''R''
  
:[[Variable Types|BYTE]] &apos;&apos;G&apos;&apos;
+
:[[Variable Types|BYTE]] ''G''
  
:[[Variable Types|BYTE]] &apos;&apos;B&apos;&apos;
+
:[[Variable Types|BYTE]] ''B''
  
  
&apos;&apos;&apos;Return value&apos;&apos;&apos;
+
'''Return value'''
  
:&apos;&apos;This call does not return a value&apos;&apos;
+
:''This call does not return a value''
  
  
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;Refresh&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
+
===<span style="font-weight: normal;"><u><tt>Refresh</tt></u></span>===
 
Clocks out the current colour data to the LEDs from the values stored in RAM
 
Clocks out the current colour data to the LEDs from the values stored in RAM
  
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
+
'''Parameters'''
  
:&apos;&apos;This macro has no parameters&apos;&apos;
+
:''This macro has no parameters''
  
  
&apos;&apos;&apos;Return value&apos;&apos;&apos;
+
'''Return value'''
  
:&apos;&apos;This call does not return a value&apos;&apos;
+
:''This call does not return a value''
  
  
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;DrawLine3D&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
+
===<span style="font-weight: normal;"><u><tt>DrawLine3D</tt></u></span>===
 
Draws a line on a 3D array of LEDs
 
Draws a line on a 3D array of LEDs
  
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
+
'''Parameters'''
  
:[[Variable Types|UINT]] &apos;&apos;X1&apos;&apos;
+
:[[Variable Types|UINT]] ''X1''
  
:[[Variable Types|UINT]] &apos;&apos;Y1&apos;&apos;
+
:[[Variable Types|UINT]] ''Y1''
  
:[[Variable Types|UINT]] &apos;&apos;Z1&apos;&apos;
+
:[[Variable Types|UINT]] ''Z1''
  
:[[Variable Types|UINT]] &apos;&apos;X2&apos;&apos;
+
:[[Variable Types|UINT]] ''X2''
  
:[[Variable Types|UINT]] &apos;&apos;Y2&apos;&apos;
+
:[[Variable Types|UINT]] ''Y2''
  
:[[Variable Types|UINT]] &apos;&apos;Z2&apos;&apos;
+
:[[Variable Types|UINT]] ''Z2''
  
:[[Variable Types|BYTE]] &apos;&apos;R&apos;&apos;
+
:[[Variable Types|BYTE]] ''R''
  
:[[Variable Types|BYTE]] &apos;&apos;G&apos;&apos;
+
:[[Variable Types|BYTE]] ''G''
  
:[[Variable Types|BYTE]] &apos;&apos;B&apos;&apos;
+
:[[Variable Types|BYTE]] ''B''
  
  
&apos;&apos;&apos;Return value&apos;&apos;&apos;
+
'''Return value'''
  
:&apos;&apos;This call does not return a value&apos;&apos;
+
:''This call does not return a value''
  
  
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;SetLEDColour2D&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
+
===<span style="font-weight: normal;"><u><tt>SetLEDColour2D</tt></u></span>===
 
Sets the colour of a single LED in RAM as a 2D array.
 
Sets the colour of a single LED in RAM as a 2D array.
  
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
+
'''Parameters'''
  
:[[Variable Types|UINT]] &apos;&apos;LED_Column&apos;&apos;
+
:[[Variable Types|UINT]] ''LED_Column''
 
::LED Column to change the colour / Range: 0 to (LED Column - 1)
 
::LED Column to change the colour / Range: 0 to (LED Column - 1)
  
:[[Variable Types|UINT]] &apos;&apos;LED_Row&apos;&apos;
+
:[[Variable Types|UINT]] ''LED_Row''
 
::LED Row to change the colour / Range: 0 to (LED Row - 1)
 
::LED Row to change the colour / Range: 0 to (LED Row - 1)
  
:[[Variable Types|BYTE]] &apos;&apos;R&apos;&apos;
+
:[[Variable Types|BYTE]] ''R''
  
:[[Variable Types|BYTE]] &apos;&apos;G&apos;&apos;
+
:[[Variable Types|BYTE]] ''G''
  
:[[Variable Types|BYTE]] &apos;&apos;B&apos;&apos;
+
:[[Variable Types|BYTE]] ''B''
  
  
&apos;&apos;&apos;Return value&apos;&apos;&apos;
+
'''Return value'''
  
:&apos;&apos;This call does not return a value&apos;&apos;
+
:''This call does not return a value''
  
  
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;SetLEDColour3D&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
+
===<span style="font-weight: normal;"><u><tt>SetLEDColour3D</tt></u></span>===
 
Sets the colour of a single LED in RAM as a 3D array.
 
Sets the colour of a single LED in RAM as a 3D array.
  
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
+
'''Parameters'''
  
:[[Variable Types|UINT]] &apos;&apos;LED_Column&apos;&apos;
+
:[[Variable Types|UINT]] ''LED_Column''
 
::LED Column to change the colour / Range: 0 to (LED Column - 1)
 
::LED Column to change the colour / Range: 0 to (LED Column - 1)
  
:[[Variable Types|UINT]] &apos;&apos;LED_Row&apos;&apos;
+
:[[Variable Types|UINT]] ''LED_Row''
 
::LED Row to change the colour / Range: 0 to (LED Row - 1)
 
::LED Row to change the colour / Range: 0 to (LED Row - 1)
  
:[[Variable Types|UINT]] &apos;&apos;LED_Layer&apos;&apos;
+
:[[Variable Types|UINT]] ''LED_Layer''
 
::LED Layer to change the colour / Range: 0 to (LED Layer - 1)
 
::LED Layer to change the colour / Range: 0 to (LED Layer - 1)
  
:[[Variable Types|BYTE]] &apos;&apos;R&apos;&apos;
+
:[[Variable Types|BYTE]] ''R''
  
:[[Variable Types|BYTE]] &apos;&apos;G&apos;&apos;
+
:[[Variable Types|BYTE]] ''G''
  
:[[Variable Types|BYTE]] &apos;&apos;B&apos;&apos;
+
:[[Variable Types|BYTE]] ''B''
  
  
&apos;&apos;&apos;Return value&apos;&apos;&apos;
+
'''Return value'''
  
:&apos;&apos;This call does not return a value&apos;&apos;
+
:''This call does not return a value''
  
  
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;Initialise&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
+
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
 
Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to  
 
Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to  
  
 
initialise all the WS2801 ICs in the chain.
 
initialise all the WS2801 ICs in the chain.
  
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
+
'''Parameters'''
  
:&apos;&apos;This macro has no parameters&apos;&apos;
+
:''This macro has no parameters''
  
  
&apos;&apos;&apos;Return value&apos;&apos;&apos;
+
'''Return value'''
  
:&apos;&apos;This call does not return a value&apos;&apos;
+
:''This call does not return a value''
  
  
Line 196: Line 196:
 
==Simulation macro reference==
 
==Simulation macro reference==
  
&apos;&apos;This component does not contain any simulation macros&apos;&apos;
+
''This component does not contain any simulation macros''
  
  
 
==Property reference==
 
==Property reference==
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;LED Arrangement&lt;/u&gt;&lt;/span&gt;
+
<span style="font-weight: normal;"><u>LED Arrangement</u></span>
  
This property is of type &apos;&apos;Fixed list of ints&apos;&apos; and can be referenced with the variable name &apos;&apos;LED_Arrangement&apos;&apos;.
+
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''LED_Arrangement''.
  
 
Controls the arrangement of the LEDs on the panel.
 
Controls the arrangement of the LEDs on the panel.
Line 214: Line 214:
 
3D - Creates an X by Y by Z Array of LEDs
 
3D - Creates an X by Y by Z Array of LEDs
  
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;LED Count&lt;/u&gt;&lt;/span&gt;
+
<span style="font-weight: normal;"><u>LED Count</u></span>
  
This property is of type &apos;&apos;Unsigned integer&apos;&apos; and can be referenced with the variable name &apos;&apos;LED_Count&apos;&apos;.
+
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''LED_Count''.
  
 
Total number of LEDs in the design
 
Total number of LEDs in the design
  
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;LED Columns&lt;/u&gt;&lt;/span&gt;
+
<span style="font-weight: normal;"><u>LED Columns</u></span>
  
This property is of type &apos;&apos;Unsigned integer&apos;&apos; and can be referenced with the variable name &apos;&apos;LED_Cols&apos;&apos;.
+
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''LED_Cols''.
  
 
Number of horizontal LEDs - X axis
 
Number of horizontal LEDs - X axis
  
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;LED Rows&lt;/u&gt;&lt;/span&gt;
+
<span style="font-weight: normal;"><u>LED Rows</u></span>
  
This property is of type &apos;&apos;Unsigned integer&apos;&apos; and can be referenced with the variable name &apos;&apos;LED_Rows&apos;&apos;.
+
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''LED_Rows''.
  
 
Number of vertical LEDs - Y axis
 
Number of vertical LEDs - Y axis
  
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;LED Layers&lt;/u&gt;&lt;/span&gt;
+
<span style="font-weight: normal;"><u>LED Layers</u></span>
  
This property is of type &apos;&apos;Unsigned integer&apos;&apos; and can be referenced with the variable name &apos;&apos;LED_Layers&apos;&apos;.
+
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''LED_Layers''.
  
 
Number of LED layers - Z axis
 
Number of LED layers - Z axis
  
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;Output Mode&lt;/u&gt;&lt;/span&gt;
+
<span style="font-weight: normal;"><u>Output Mode</u></span>
  
This property is of type &apos;&apos;Fixed list of ints&apos;&apos; and can be referenced with the variable name &apos;&apos;Output_Mode&apos;&apos;.
+
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Output_Mode''.
  
 
Sets the output mode used to drive the data to the LEDs
 
Sets the output mode used to drive the data to the LEDs
Line 248: Line 248:
 
SPI Mode = Fixed SPI Peripheral Pins but may be faster - Note that the SPI MISO pin will not be available for general I/O
 
SPI Mode = Fixed SPI Peripheral Pins but may be faster - Note that the SPI MISO pin will not be available for general I/O
  
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;Data Pin&lt;/u&gt;&lt;/span&gt;
+
<span style="font-weight: normal;"><u>Data Pin</u></span>
  
This property is of type &apos;&apos;Single digital pin&apos;&apos; and can be referenced with the variable name &apos;&apos;MOSI&apos;&apos;.
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''MOSI''.
  
 
LED Data Pin - Connected to the Data In pin of the first WS8201 IC.
 
LED Data Pin - Connected to the Data In pin of the first WS8201 IC.
  
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;Clock Pin&lt;/u&gt;&lt;/span&gt;
+
<span style="font-weight: normal;"><u>Clock Pin</u></span>
  
This property is of type &apos;&apos;Single digital pin&apos;&apos; and can be referenced with the variable name &apos;&apos;CLK&apos;&apos;.
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''CLK''.
  
 
LED Clock Pin - Connected to the Clock In pin of the first WS8201 IC.
 
LED Clock Pin - Connected to the Clock In pin of the first WS8201 IC.

Revision as of 16:56, 24 August 2016

Author Matrix TSL
Version 1.0 (Release)
Category Outputs: LEDs


Image LED WS2801 component

A simple chained RGB LED controller IC allowing multiple LEDs to be controlled using a serial data stream. Allows RGB LEDs to be driven with full 24-bit colour depth. Allows single chains, 2D arrays and 3D cube formations to be simulated. Supports Bit Banged or SPI peripheral based data modes.

Examples

No additional examples


Downloadable macro reference

DrawLine2D

Draws a line on a 2D array of LEDs

Parameters

UINT X1
UINT Y1
UINT X2
UINT Y2
BYTE R
BYTE G
BYTE B


Return value

This call does not return a value


SetAllLEDColour

Sets the colour of all the LEDs in RAM

Parameters

BYTE R
BYTE G
BYTE B


Return value

This call does not return a value


SetLEDColour

Sets the colour of a single LED in RAM as a 1D array.

Parameters

UINT LED
LED to change the colour / Range: 0 to (LED Count - 1)
BYTE R
BYTE G
BYTE B


Return value

This call does not return a value


Refresh

Clocks out the current colour data to the LEDs from the values stored in RAM

Parameters

This macro has no parameters


Return value

This call does not return a value


DrawLine3D

Draws a line on a 3D array of LEDs

Parameters

UINT X1
UINT Y1
UINT Z1
UINT X2
UINT Y2
UINT Z2
BYTE R
BYTE G
BYTE B


Return value

This call does not return a value


SetLEDColour2D

Sets the colour of a single LED in RAM as a 2D array.

Parameters

UINT LED_Column
LED Column to change the colour / Range: 0 to (LED Column - 1)
UINT LED_Row
LED Row to change the colour / Range: 0 to (LED Row - 1)
BYTE R
BYTE G
BYTE B


Return value

This call does not return a value


SetLEDColour3D

Sets the colour of a single LED in RAM as a 3D array.

Parameters

UINT LED_Column
LED Column to change the colour / Range: 0 to (LED Column - 1)
UINT LED_Row
LED Row to change the colour / Range: 0 to (LED Row - 1)
UINT LED_Layer
LED Layer to change the colour / Range: 0 to (LED Layer - 1)
BYTE R
BYTE G
BYTE B


Return value

This call does not return a value


Initialise

Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to

initialise all the WS2801 ICs in the chain.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

LED Arrangement

This property is of type Fixed list of ints and can be referenced with the variable name LED_Arrangement.

Controls the arrangement of the LEDs on the panel.


1D - Creates a straight line of LEDs

2D - Creates an X by Y Array of LEDs

3D - Creates an X by Y by Z Array of LEDs

LED Count

This property is of type Unsigned integer and can be referenced with the variable name LED_Count.

Total number of LEDs in the design

LED Columns

This property is of type Unsigned integer and can be referenced with the variable name LED_Cols.

Number of horizontal LEDs - X axis

LED Rows

This property is of type Unsigned integer and can be referenced with the variable name LED_Rows.

Number of vertical LEDs - Y axis

LED Layers

This property is of type Unsigned integer and can be referenced with the variable name LED_Layers.

Number of LED layers - Z axis

Output Mode

This property is of type Fixed list of ints and can be referenced with the variable name Output_Mode.

Sets the output mode used to drive the data to the LEDs

Bit Banged Mode = Allows Any I/O Pin but may be slower

SPI Mode = Fixed SPI Peripheral Pins but may be faster - Note that the SPI MISO pin will not be available for general I/O

Data Pin

This property is of type Single digital pin and can be referenced with the variable name MOSI.

LED Data Pin - Connected to the Data In pin of the first WS8201 IC.

Clock Pin

This property is of type Single digital pin and can be referenced with the variable name CLK.

LED Clock Pin - Connected to the Clock In pin of the first WS8201 IC.