Difference between revisions of "Component: LED Array (LEDs)"
Line 17: | Line 17: | ||
==Component Source Code== | ==Component Source Code== | ||
− | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/ | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_temp/LED_Array_2dgi.fcfx FC_Comp_Source_temp/LED_Array_2dgi.fcfx] |
− | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/ | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_temp/LED_Array_2dgi.fcfx FC_Comp_Source_temp/LED_Array_2dgi.fcfx] |
==Detailed description== | ==Detailed description== | ||
Line 97: | Line 97: | ||
{{Fcfile|7segCharDemo.fcfx|7Segment Character Demo}} | {{Fcfile|7segCharDemo.fcfx|7Segment Character Demo}} | ||
+ | |||
+ | |||
Line 104: | Line 106: | ||
==Macro reference== | ==Macro reference== | ||
− | === | + | ===AllOff=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AllOff''' |
+ | |- | ||
+ | | colspan="2" | Turns off all elements | ||
+ | |- | ||
|- | |- | ||
− | | | + | | 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'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===AllOn=== | ||
+ | {| 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;" | '''AllOn''' | ||
|- | |- | ||
− | | | + | | colspan="2" | Turns on all elements |
− | |||
|- | |- | ||
− | |||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 123: | Line 134: | ||
− | === | + | ===BarGraph=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BarGraph''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Turns on the first N elements of the array - for generating bar graph metes etc. |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Length |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | How many items to light up. |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 142: | Line 153: | ||
− | === | + | ===LEDOff=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LEDOff''' |
+ | |- | ||
+ | | colspan="2" | Turn off the selected led. | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
+ | | width="90%" | Index | ||
|- | |- | ||
+ | | colspan="2" | Index of the LED to turn on. | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 156: | Line 172: | ||
− | === | + | ===LEDOn=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LEDOn''' |
|- | |- | ||
− | | colspan="2" | Turn | + | | colspan="2" | Turn on the selected LED. |
|- | |- | ||
|- | |- | ||
Line 207: | Line 223: | ||
|- | |- | ||
| colspan="2" | Provide a value to be written to the LEDs in binary | | colspan="2" | Provide a value to be written to the LEDs in binary | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
Revision as of 12:01, 3 February 2023
Author | Matrix TSL |
Version | 1.0 |
Category | LEDs |
Contents
LED Array component
An array of LED indicators equally spaced and complete with labels to indicate their meaning. Embedded can be used to control an 8-bit port or up to 8 individual pins.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_temp/LED_Array_2dgi.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_temp/LED_Array_2dgi.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Each segment will require a current limiting resistor.
This LED Calculator tool is a good resource for calculating the correct LED series protection resistor.
Simple Counter
This example counts up from 0 to 9 on the 7-segment display before wrapping back to 0 and starting again. When displaying odd numbers we light the decimal point segment.
7Segment Display Example
Multiplexed Counter
This next example counts up from 0 to 99 on two 7-segment displays before wrapping back to 0 and starting again. The two displays are driven using a technique called multiplexing. A timer interrupt is used to perform the multiplexing leaving our program free to perform other tasks. Each 7-segment display shares the same segment pin connections but has a unique common pin connection to allow each individual 7-segment display to display a unique value.
7Segment Multiplex
Stop Watch
This next example uses a timer interrupt to multiplex between the displays and a second timer interrupt to count the passing of time allowing for accurate timings. Using four single 7-seg components we create a timer capable of monitoring time from 0.0 to 999.9 seconds in multiples of 100ms. The second timer interrupt flags to the main when the count value has changed allowing the heavier calculations to extract the digits from the counter to be done outside of the high speed interrupt routine and therefore maintain accurate timing.
Switches connected to Port D allow for the timer to be started, stopped and reset.
7Segment Timer
Segment Control
This example shows a method to display custom characters on 7-segment displays and also allows for numeric values to be displayed.
Macro reference
AllOff
![]() |
AllOff |
Turns off all elements | |
![]() |
Return |
AllOn
![]() |
AllOn |
Turns on all elements | |
![]() |
Return |
BarGraph
![]() |
BarGraph |
Turns on the first N elements of the array - for generating bar graph metes etc. | |
![]() |
Length |
How many items to light up. | |
![]() |
Return |
LEDOff
![]() |
LEDOff |
Turn off the selected led. | |
![]() |
Index |
Index of the LED to turn on. | |
![]() |
Return |
LEDOn
![]() |
LEDOn |
Turn on the selected LED. | |
![]() |
Index |
Index of the LED to turn on. | |
![]() |
Return |
PointGraph
![]() |
PointGraph |
Turns on the Indexed LED and turns all others off. Does nothing if the index is out of range. | |
![]() |
Index |
The LED to show. | |
![]() |
Return |
WriteValue
![]() |
WriteValue |
Write a number which is presented on the LEDs in binary. | |
![]() |
Value |
Provide a value to be written to the LEDs in binary | |
![]() |
Return |