|
|
(8 intermediate revisions by 2 users not shown) |
Line 17: |
Line 17: |
| ==Component Source Code== | | ==Component Source Code== |
| | | |
− | Please click here to download the component source project: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_LED_7Seg_Single.fcfx FC_Comp_Source_LED_7Seg_Single.fcfx] | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_LED_7Seg_Single_2dgi.fcfx FC_Comp_Source_LED_7Seg_Single_2dgi.fcfx] |
| | | |
− | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_LED_7Seg_Single.fcfx FC_Comp_Source_LED_7Seg_Single.fcfx] | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_LED_7Seg_Single_2dgi.fcfx FC_Comp_Source_LED_7Seg_Single_2dgi.fcfx] |
| | | |
| ==Detailed description== | | ==Detailed description== |
Line 33: |
Line 33: |
| | | |
| | | |
− | ''No detailed description exists yet for this component''
| |
| | | |
− | ==Examples==
| |
| | | |
| | | |
| | | |
| + | ''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. |
| + | {{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}} |
| | | |
| | | |
− | ''<span style="color:red;">No additional examples</span>''
| + | ===Stop Watch=== |
| | | |
− | ==Macro reference==
| + | 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. |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| + | Switches connected to Port D allow for the timer to be started, stopped and reset. |
− | |-
| + | {{Fcfile|7Seg_Test3.fcfx|7Segment Timer}} |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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
| |
− | |- | |
− | |-
| |
− | | 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''
| |
− | |} | |
| | | |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| + | ===Segment Control=== |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShowSegments'''
| |
− | |-
| |
− | | colspan="2" | Allows the individual segments of the display to be controlled.
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| |
− | | width="90%" | Segments
| |
− | |-
| |
− | | colspan="2" | 8-bit Binary value to set the segments, bit0 = segA, bit1 = segB...
| |
− | |-
| |
− | | 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''
| |
− | |}
| |
| | | |
| + | This example shows a method to display custom characters on 7-segment displays and also allows for numeric values to be displayed. |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | + | {{Fcfile|7segCharDemo.fcfx|7Segment Character Demo}} |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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.
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| |
− | | width="90%" | Digit
| |
− | |-
| |
− | | colspan="2" | Sets the 7seg display with the appropriate digit supplied
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| |
− | | width="90%" | DecimalPoint
| |
− | |-
| |
− | | colspan="2" | Determines whether decimal point LED is active (True/False)
| |
− | |-
| |
− | | 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''
| |
− | |} | |
| | | |
| | | |
| | | |
| | | |
− | ==Property reference==
| |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| + | ==Macro reference== |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Display Type
| |
− | |-
| |
− | | colspan="2" | Set this property to match your hardware device. Common Anode: Pin true -> LED off, Pin false -> LED on Common Cathods: Pin true -> LED on, Pin false -> LED off
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
− | | width="90%" | Show Seg Labels
| |
− | |-
| |
− | | colspan="2" | Show the identifier lables of the segments overlayed over the component.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
− | | width="90%" | Common Pin
| |
− | |-
| |
− | | colspan="2" | When using a single 7-segment display you can keep the common pin active by connecting it to VCC or VSS so no output pin is required. When using multiple 7-seg displays you need the common pin to allow you to multiplex between the displays.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Common Type
| |
− | |-
| |
− | | 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" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| |
− | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin0 (A)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'A' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin1 (B)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'B' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin2 (C)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'C' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin3 (D)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'D' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin4 (E)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'E' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin5 (F)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'F' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin6 (G)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'G' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin7 (DP)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the decimal pointt of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | common
| |
− | |-
| |
− | | colspan="2" | Pin connection to the 'common' pin of the display - to allow enable/disable of the whole display.
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| |
− | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Colors
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]]
| |
− | | width="90%" | LED Color
| |
− | |-
| |
− | | colspan="2" | Color when an LED is turned on. When turned off, will use a much darker shade of the same hue.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]]
| |
− | | width="90%" | Bezel Color
| |
− | |-
| |
− | | colspan="2" | Color of the plastic package housing the LEDs
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]]
| |
− | | width="90%" | Label Color
| |
− | |-
| |
− | | colspan="2" | Color of the optional segment name labels.
| |
− | |}==Macro reference==
| |
| | | |
| + | ===ClearDigit=== |
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
| |- | | |- |
Line 217: |
Line 87: |
| | | |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| + | ===ShowDigit=== |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShowSegments'''
| |
− | |-
| |
− | | colspan="2" | Allows the individual segments of the display to be controlled.
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| |
− | | width="90%" | Segments
| |
− | |-
| |
− | | colspan="2" | 8-bit Binary value to set the segments, bit0 = segA, bit1 = segB...
| |
− | |-
| |
− | | 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''
| |
− | |}
| |
− | | |
− | | |
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
| |- | | |- |
Line 258: |
Line 111: |
| | | |
| | | |
− | | + | ===ShowSegments=== |
− | | |
− | ==Property reference== | |
− | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Display Type
| |
− | |-
| |
− | | colspan="2" | Set this property to match your hardware device. Common Anode: Pin true -> LED off, Pin false -> LED on Common Cathods: Pin true -> LED on, Pin false -> LED off
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
− | | width="90%" | Show Seg Labels
| |
− | |-
| |
− | | colspan="2" | Show the identifier lables of the segments overlayed over the component.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
− | | width="90%" | Common Pin
| |
− | |-
| |
− | | colspan="2" | When using a single 7-segment display you can keep the common pin active by connecting it to VCC or VSS so no output pin is required. When using multiple 7-seg displays you need the common pin to allow you to multiplex between the displays.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Common Type
| |
− | |-
| |
− | | 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" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| |
− | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin0 (A)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'A' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin1 (B)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'B' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin2 (C)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'C' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin3 (D)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'D' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin4 (E)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'E' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin5 (F)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'F' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin6 (G)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the 'G' degment of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | pin7 (DP)
| |
− | |-
| |
− | | colspan="2" | Pin connected to the decimal pointt of the display.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
− | | width="90%" | common
| |
− | |-
| |
− | | colspan="2" | Pin connection to the 'common' pin of the display - to allow enable/disable of the whole display.
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| |
− | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Colors
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]]
| |
− | | width="90%" | LED Color
| |
− | |-
| |
− | | colspan="2" | Color when an LED is turned on. When turned off, will use a much darker shade of the same hue.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]]
| |
− | | width="90%" | Bezel Color
| |
− | |-
| |
− | | colspan="2" | Color of the plastic package housing the LEDs
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]]
| |
− | | width="90%" | Label Color
| |
− | |-
| |
− | | colspan="2" | Color of the optional segment name labels.
| |
− | |}==Macro reference==
| |
− | | |
− | {| 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;" | '''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
| |
− | |-
| |
− | |-
| |
− | | 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''
| |
− | |}
| |
− | | |
− | | |
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
| |- | | |- |
Line 386: |
Line 128: |
| | width="90%" style="border-top: 2px solid #000;" | ''Return'' | | | width="90%" style="border-top: 2px solid #000;" | ''Return'' |
| |} | | |} |
− |
| |
− |
| |
− | {| 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;" | '''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.
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| |
− | | width="90%" | Digit
| |
− | |-
| |
− | | colspan="2" | Sets the 7seg display with the appropriate digit supplied
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| |
− | | width="90%" | DecimalPoint
| |
− | |-
| |
− | | colspan="2" | Determines whether decimal point LED is active (True/False)
| |
− | |-
| |
− | | 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''
| |
− | |}
| |
− |
| |
− |
| |
| | | |
| | | |
Line 495: |
Line 212: |
| |- | | |- |
| | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] |
− | | width="90%" | LED Color | + | | width="90%" | LED Colour |
| |- | | |- |
| | colspan="2" | Color when an LED is turned on. When turned off, will use a much darker shade of the same hue. | | | colspan="2" | Color when an LED is turned on. When turned off, will use a much darker shade of the same hue. |
| |- | | |- |
| | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] |
− | | width="90%" | Bezel Color | + | | width="90%" | Bezel Colour |
| |- | | |- |
| | colspan="2" | Color of the plastic package housing the LEDs | | | colspan="2" | Color of the plastic package housing the LEDs |
| |- | | |- |
| | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] | | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] |
− | | width="90%" | Label Color | + | | width="90%" | Label Colour |
| |- | | |- |
| | colspan="2" | Color of the optional segment name labels. | | | colspan="2" | Color of the optional segment name labels. |
| + | |- |
| + | | width="10%" align="center" | [[File:Fc9-type-1-icon.png]] |
| + | | width="90%" | LED Auto Off Colour |
| + | |- |
| + | | colspan="2" | Color when an LED is turned on. When turned off, will use a much darker shade of the same hue. |
| |} | | |} |