Component: 7Segment (Quad) (Displays: Segment)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.2 (Release)
Category Displays: Segment


Image 7Segment (Quad) component

14mm seven segment display. LED colour can be set from properties.

Examples

Basic Multiplexing

Only one of the four 7-segment LEDs can be enabled at a time so we need a way of multiplexing the output so that we can display a number on all four LEDs. To do this we switch between LED outputs at fairly high speed and persistence of vision allows the display to appear fixed and constant.

This example demonstrates a very basic loop to display a four digit number multiplexed across four 7segment displays. FC6 Icon.png Quad 7Segment Display Example

Timer Based Multiplexing

This example demonstrates a timer interrupt to display a four digit number multiplexed across four 7segment displays. The timer interrupt takes care of updating the display leaving our program free to count up in 100ms increments. FC6 Icon.png Quad 7Segment Display Example 2 The panel should show the simulation run time down to the current tenth of a second.

QuadSegCount.jpg

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.

FC6 Icon.png 7Segment Timer

Downloadable macro reference

ShowDigit

Set the number and decimal point to be displayed in the given digit of the display.

Parameters

BYTE Digit
Which of the four digits to change. (0...3)
BYTE Value
The number value to set the digit to (0...15), 16=Clear
BYTE DecimalPoint
Whether to show the decimal point for the chosen digit.


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Display Type

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

Set this according to the specification of your hardware display.

Common Anode: Pin true -> LED Off, Pin false -> LED On

Common Cathode: Pin true -> LED On, Pin false -> LED Off

Show Seg Labels

This property is of type True or false and can be referenced with the variable name ShowSegLabels.

Show segment name labels overlayed over the component.

Common Pin 0

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

Pin to enable the first digit.

Common Pin 1

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

Pin to enable the second digit.

Common Pin 2

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

Pin to enable the third digit.

Common Pin 3

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

Pin to enable the fourth digit.

Pin0 (A)

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

Pin for the 'A' segments of the displays.

Pin1 (B)

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

Pin for the 'B' segments of the displays.

Pin2 (C)

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

Pin for the 'C' segments of the displays.

Pin3 (D)

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

Pin for the 'D' segments of the displays.

Pin4 (E)

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

Pin for the 'E' segments of the displays.

Pin5 (F)

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

Pin for the 'F' segments of the displays.

Pin6 (G)

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

Pin for the 'G' segments of the displays.

Pin7 (DP)

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

Pin for the decimal points of the displays.

LED Color

This property is of type Color picker and can be referenced with the variable name FGColor.

Color of the LED segments when truned on. When off, they use a much darker shade of the same hue.

Body Color

This property is of type Color picker and can be referenced with the variable name BGColor.

Color of the plastic casing containing the LEDs.

Label Color

This property is of type Color picker and can be referenced with the variable name LabelColor.

Color for the optional LED segment labels.