|
|
| Line 69: |
Line 69: |
|
| |
|
| [https://www.digikey.co.uk/en/resources/conversion-calculators/conversion-calculator-led-series-resistor LED Resistor Calculator Tool] | | [https://www.digikey.co.uk/en/resources/conversion-calculators/conversion-calculator-led-series-resistor LED Resistor Calculator Tool] |
|
| |
|
| |
|
| |
| ===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.
| |
| {{Fcfile|7Seg_Test.fcfx|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.
| |
| {{Fcfile|7Seg_Test2.fcfx|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.
| |
| {{Fcfile|7Seg_Test3.fcfx|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.
| |
|
| |
| {{Fcfile|7segCharDemo.fcfx|7Segment Character Demo}}
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| ==Macro reference== | | ==Macro reference== |
Revision as of 07:29, 11 April 2023
| Author
|
Matrix TSL
|
| Version
|
1.0
|
| Category
|
LEDs
|
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_LED_Array_2dgi.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_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.
LED Resistor Calculator Tool
Macro reference
AllOff
|
AllOff
|
| Turns off all elements
|
- VOID
|
Return
|
AllOn
|
AllOn
|
| Turns on all elements
|
- VOID
|
Return
|
BarGraph
|
BarGraph
|
| Turns on the first N elements of the array - for generating bar graph metes etc.
|
- BYTE
|
Length
|
| How many items to light up.
|
- VOID
|
Return
|
LEDOff
|
LEDOff
|
| Turn off the selected led.
|
- BYTE
|
Index
|
| Index of the LED to turn on.
|
- VOID
|
Return
|
LEDOn
|
LEDOn
|
| Turn on the selected LED.
|
- BYTE
|
Index
|
| Index of the LED to turn on.
|
- VOID
|
Return
|
PointGraph
|
PointGraph
|
| Turns on the Indexed LED and turns all others off. Does nothing if the index is out of range.
|
- BYTE
|
Index
|
| The LED to show.
|
- VOID
|
Return
|
WriteValue
|
WriteValue
|
| Write a number which is presented on the LEDs in binary.
|
- BYTE
|
Value
|
| Provide a value to be written to the LEDs in binary
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
Count
|
| The number of LEDs in the array from 1 to 8.
|
|
Connections
|
|
Output Mode
|
|
|
|
Port
|
|
|
|
Polarity
|
|
|
|
Simulation
|
|
Switch layout
|
|
|
|
Distance between LEDs
|
|
|
|
Label colour
|
|
|
|
Component Label
|
|
|
|
Show Connection Label
|
| If enabled, the pin designation will be shown, e.g. B0.
|
|
Show Pin Value
|
| Pin status of VCC or GND will be shown when enabled and simualtion is running.
|
|
Appearance
|
|
Shape
|
|
|
|
Colour
|
|
|
|
Style
|
|
|