o7Seg2 Object

Back to top of page Description:
 An o7Seg2 Object is a Hardware Object that controls the LED segments in a Dual 7-Segment LED Display.  It is capable of setting the segments with a value of 0 through 99 and letters AA though FF.  In addition, each of the 14 segments and both decimal points are is individually controllable allowing graphical patterns. 

Which number is displayed is controlled by a single value with a range of  -128 to +127 and a Mode property which selects between hexadecimal and decimal operations. 

The o7Seg2 Object uses eight digital I/O lines to control the 8 LEDs in the display.

 The following table lists the size and availability of the o7Seg2 Object.
 ObjectSizeDescriptionA1A2B1B2C1
o7Seg214 BytesAn Object that displays a number on a Dual 7-Segment LED display.x
Back to top of page Operation:
 The Value property controls the number shown on the display.  Setting the Value property will cause the individual segments in the display to be set in such a way that they show the number assigned to the Value property.  For example, If the value 11 is written, then segments B and C in both digits are turned on while the rest are turned off.  Likewise, if the value 8 is written, then all segments except the Decimal Points are turned on.  When the Value property is read it will return the last value that was written to it. Note that if the segments are manually changed (as described below), the Value property will not reflect the changes.  Instead, the Value property will still read back the last value that was written to it. 

The Mode property specifies if the display will show decimal or hexadecimal numbers. 

Because the Value property can be read or written, it can be used in mathematical operations.  For example, to increase the value displayed, the following code can be used (where D is the name of the o7Seg2 object.)  :

D.Value = D.Value + 1
D.value++;

The Ones and Tens properties are instances of the o7Seg object witch provide the individual digits.  Each of these objects are independently controllable.  (See the o7Seg Object help page for more details)   Each digit also contains the actual numeric value for itself.  As noted above, when the Value property is written to, the segments required to display the value are determined and then the Segments property is set to the sum of those values.  For example, If the value 12 is written to the Value property, then the two digits are split up and assigned accordingly to their respective displays.

Each of the two digits also have segment data that allows the segments to be controlled on a bit by bit basis.  Within the Segments property of the two o7Seg objects, each bit is assigned a name that specifies which segment that it controls.  For example, the following code will turn on the "G" segment in the ones column.

D.Ones.Segment.A = 64

The Decimal Points are also controlled in this way.  Note that unlike the other segments, the state of the Decimal Points are not changed when the Value property is written to.

The IOGroup property specifies which group of 8 I/O lines is used to output the data to the segments.  The I/O groups are 8 contiguous I/O Lines beginning at I/O line 8, 16, or 24.  In each group, the first I/O line is considered bit 0 and the last is considered bit 7.

The IOLineD property specifies which I/O line is used to multiplex the two digits.  Multiplexing is a function that allows the two digits to share a single IOGroup.

Back to top of page Properties:

The following table lists the properties of the o7Seg2 Object:

Property

Description

Value
The value displayed on the two digits
Object Class: oChar Value Range: 
Data Type: Numeric Default Value: 0
Ones
The ones column digit
Object Class: o7Seg Value Range: 0 - 15
Data Type: Numeric Default Value: 0
Tens
The tens column digit
Object Class: o7Seg Value Range: 0 - 15
Data Type: Numeric Default Value: 0
IOGroup
A value that specifies which group of 8 I/O lines is connected to the Display.
Object Class: oIOGroup Value Range: 0 - 3
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOGroup for details.
IOLineD
A value that specifies which I/O line is used to multiplex the digits.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
Mode
A value that selects if the display shows the value as Decimal or Hexadecimal.
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe display shows decimal numbers.
1cvOnThe display shows hexadecimal numbers.
Operate
A value that selects if the display is on or off.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe display is off.
1cvOnThe display is on.
DIO
The DIO1 used to select the digit.
Object Class: oDIO1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Address
Returns a pointer to the address of the o7Seg2 Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of page Example:

The following examples use the o7Seg2 Object.
Visual Basic Syntax C and Java Syntax
' This program reads two knob objects
' and sets each side of a dual digit
' 7-Segment display accordingly.

Dim d As o7Seg2
Dim k1 As oKnob
Dim k2 As oKnob

Sub main()
  d.IOGroup = 3
  d.IOLineD=16
  d.Operate = cvOn
  k1.IOLine = 1
  k1.Operate = 1
  k2.IOLine = 2
  k2.Operate = 1
  Do
    d.Tens = k1 /26
    d.Ones = k2 /26
  Loop
End Sub
// This program reads two knob objects
// and sets each side of a dual digit
// 7-Segment display accordingly.

o7Seg2 d = New o7Seg2;
oKnob k1 = New oKnob;
oKnob k2 = New oKnob;

Void main(Void){
  d.IOGroup = 3;
  d.IOLineD=16;
  d.Operate = cvOn;
  k1.IOLine = 1;
  k1.Operate = 1;
  k2.IOLine = 2;
  k2.Operate = 1;
  Do{
    d.Tens = k1/26;
    d.Ones = k2/26;
  } While (1);
}
Basic Syntax 
' This program reads two knob objects
' and sets each side of a dual digit
' 7-Segment display accordingly.

d As o7Seg2(3,16,0,0,1)
k1 As oKnob(1,1)
k2 As oKnob(2,1)

Do
  d.Tens = k1 /26
  d.Ones = k2 /26
Loop
 
Back to top of pageConnections:
 A Dual 7-Segment LED Display uses 8 contiguous I/O lines and one single I/O line.  The 8 I/O Lines are specified with the IOGroup property and the single I/O line is specified with the IOLineD property.  Each I/O line needs to be attached to a resistor and then to the appropriate pin on the display.  The I/O line specified by the IOLineD property is used to multiplex the two digits and needs to be attached to a inverting driver as shown.
Dual 7 Segment LED Display.


Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oLCDControls a LCD Display.xxx
oVideoICControls an Intuitive Circuits On-Screen Display Character Overlay board.xxx
Back to top of page Version History and Bug List:
 Firmware Ver C1: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.