Difference between revisions of "Component: 7Segment (Single) (Displays: Segment)"

From Flowcode Help
Jump to navigationJump to search
Line 25: Line 25:
  
  
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.
+
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. Note that the simulation may struggle to correctly show the multiplexing but the real hardware will work as expected.
  
 
{{Fcfile|7Seg_Test2.fcfx|7Segment Multiplex}}
 
{{Fcfile|7Seg_Test2.fcfx|7Segment Multiplex}}
 
  
 
==Downloadable macro reference==
 
==Downloadable macro reference==

Revision as of 13:05, 9 February 2017


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


Image 7Segment (Single) component

Seven segment display modelled after a standard 14mm high unit. LED colour can be changed in properties.

Examples

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.

FC6 Icon.png 7Segment Display Example


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. Note that the simulation may struggle to correctly show the multiplexing but the real hardware will work as expected.

FC6 Icon.png 7Segment Multiplex

Downloadable macro reference

ClearDigit

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

Parameters

This macro has no parameters


Return value

This call does not return a value


ShowDigit

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.

Parameters

BYTE Digit
Sets the 7seg display with the appropriate digit supplied
BYTE DecimalPoint
Determines whether decimal point LED is active (True/False)


Return value

This call does not return a value


Simulation macro reference

ClearDigitSim

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

Parameters

This macro has no parameters


Return value

This call does not return a value



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 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

Show Seg Labels

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

Show the identifier lables of the segments overlayed over the component.

Common Pin

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

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.

pin0 (A)

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

Pin connected to the 'A' degment of the display.

pin1 (B)

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

Pin connected to the 'B' degment of the display.

pin2 (C)

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

Pin connected to the 'C' degment of the display.

pin3 (D)

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

Pin connected to the 'D' degment of the display.

pin4 (E)

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

Pin connected to the 'E' degment of the display.

pin5 (F)

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

Pin connected to the 'F' degment of the display.

pin6 (G)

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

Pin connected to the 'G' degment of the display.

pin7 (DP)

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

Pin connected to the decimal pointt of the display.

common

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

Pin connection to the 'common' pin of the display - to allow enable/disable of the whole display.

LED Color

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

Color when an LED is turned on. When turned off, will use a much darker shade of the same hue.

Bezel Color

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

Color of the plastic package housing the LEDs

Label Color

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

Color of the optional segment name labels.