Component: 7Segment (Single) (Segment): Difference between revisions
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;" align="center"" to "width="10%" align="center" class="mtx-class-macrohead"" |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 77: | Line 77: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ClearDigit''' | ||
|- | |- | ||
| colspan="2" | This funtion clears all the individual segments including the decimal point segment. In simulation this sets the colours to the default BGColor component variable. It's default value is 0xCCCCCC | | colspan="2" | This funtion clears all the individual segments including the decimal point segment. In simulation this sets the colours to the default BGColor component variable. It's default value is 0xCCCCCC | ||
| Line 91: | Line 91: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ShowDigit''' | ||
|- | |- | ||
| colspan="2" | Creates the supplied digit on the 7 segment display. Macro takes the digit to display and a boolean representing whether to display the decimal point segment or not. | | colspan="2" | Creates the supplied digit on the 7 segment display. Macro takes the digit to display and a boolean representing whether to display the decimal point segment or not. | ||
| Line 115: | Line 115: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ShowSegments''' | ||
|- | |- | ||
| colspan="2" | Allows the individual segments of the display to be controlled. | | colspan="2" | Allows the individual segments of the display to be controlled. | ||
| Line 134: | Line 134: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| Line 158: | Line 158: | ||
| colspan="2" | The state of the output common pin when the 7-segment display is active. Usually a common cathode display uses a low signal and a common anode uses a high signal. If the common pin is routed via a transistor for power amplification then the signal may need to be reversed. | | colspan="2" | The state of the output common pin when the 7-segment display is active. Usually a common cathode display uses a low signal and a common anode uses a high signal. If the common pin is routed via a transistor for power amplification then the signal may need to be reversed. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Connections | ||
|- | |- | ||
|- | |- | ||
| Line 207: | Line 207: | ||
| colspan="2" | Pin connection to the 'common' pin of the display - to allow enable/disable of the whole display. | | colspan="2" | Pin connection to the 'common' pin of the display - to allow enable/disable of the whole display. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Colors | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:36, 13 July 2026
| Author | Matrix Ltd |
| Version | 1.4 |
| Category | Segment |
7Segment (Single) component
Seven segment display modelled after a standard 14mm high unit. LED colour can be changed in properties.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_LED_7Seg_Single_2dgi.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_LED_7Seg_Single_2dgi.fcfx
Detailed description
No detailed description exists yet for this component
Examples
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
ClearDigit
ShowDigit
ShowSegments
| ShowSegments | |
| Allows the individual segments of the display to be controlled. | |
| Segments | |
| 8-bit Binary value to set the segments, bit0 = segA, bit1 = segB... | |
| Return | |