o8Bar Object

Back to top of page Description:
 An o8Bar Object is a Hardware Object that controls the LED segments in an 8 Segment LED Bar Display.  It is capable of representing a value as a bar graph level. In addition, each of the 8 segments are individually controllable allowing graphical patterns. 

The o8Bar 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 o8Bar Object.
 ObjectSizeDescriptionA1A2B1B2C1
o8Bar An Object that displays a number on an 8-Segment LED bargraph.x
Back to top of page Operation:
 The Value property controls the level shown on the display.  When the Value property is written to, it will take 8-bits from the 16-bit value stored in the Pattern property.  If a 0 is written, then the first bit taken will be bit-0 and the last bit will be bit-7. If a 1 is written, then the first bit taken will be bit 1 and so on.  If a value of more than 7 is written, the the 8 bits will wrap the 16 bits.

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 o8Bar object.) :

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

The Segments property contains the actual binary data that specifies which of the LEDs are on and off.  As true with any binary data, bit 0 has a value of 1 while bit 7 has a value of 127.  As noted above, when the Value property is written to, the segments the Segments property is set to the bit pattern retrieved from the Pattern property.

The binary data contained within the Segments property can also be controlled on a bit by bit basis.  Within the Segments property, each bit is assigned a name that specifies which segment that it controls.  For example, the following code will turn on the "G" segment:

D.Segment.G = 64

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 DIO property is an instance of the oDIO8B object which is created when the o8Bar object is.  The o8Bar object configures the oDIO8B object in such a way that it will control the 8 Segment Bar Display.  Attributes of the display's operation can be adjusted by directly manipulating the oDIO8B object. Note that doing so may change the way the output behaves to something different than the way described in this document.  (see oDIO8B object for more detail)

Back to top of page Properties:

The following table lists the properties of the o8Bar Object:

Property

Description

Position
A linkable value that controls the Position property.
Object Class: oNib Value Range: 0 - 15
Data Type: Numeric Default Value: 0
The position specifies the first bit of eight that will be selected out of the Pattern property.
IOGroup
A value that specifies which group of 8 I/O lines is connected to the Bargraph.
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.
Segments
The raw binary value used to control the Individual LED Segments
Object Class: oBarSegments Value Range: 0 - 255
Data Type: Numeric Default Value: 0
Pattern
A value that specifies a bit-pattern to show on the bars.
Object Class: oVar16 Value Range: 0 - 65535
Data Type: Numeric Default Value: 0
The pattern is a series of bits that draw the image for the bargraph.  8 consecutive bits of the pattern are shown on the display when a value is written to the Position property.  Different bit patterns can be specified to perform different Bar Graph functions.  By using the Binary Number designator "&b", a bit pattern can be specified using ones and zeros:
Rising Bar = &b0000000011111111
Single Bar = &b0000000100000001
Operate
A value that selects if the bargraph 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.
Address
Returns a pointer to the address of the oCounter 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 o8Bar Object.
Visual Basic SyntaxC and Java Syntax
' This program moves a pattern 
' across an eight light bar graph.

D As o8Bar
K As oKnob

Sub MAIN()
  D.IOGroup = 1
  D.Pattern = &b0000000011111111
  D.Operate = cvOn
  K.IOLine = 1
  K.Operate = 1
  
  Do
    D.Position = D.Position + 1
    Delay = K.Position
  Loop
End Sub
// This program moves a pattern 
// across an eight light bar graph.

o8Bar D = New o8Bar;
oKnob K = New oKnob;

Void MAIN(Void){
  D.IOGroup = 1;
  D.Pattern = &b0000000011111111;
  D.Operate = cvOn;
  K.IOLine = 1;
  K.Operate = 1;

  Do{
    D.Position++;
    Delay = K.Position;
  } 
}
Basic Syntax 
' This program moves a pattern 
' across an eight light bar graph.

D As o8Bar(1,&b0000000011111111,0,1)
K As oKnob(1,1)

Do
  D.Position++
  Delay = K.Position
Loop
 
Back to top of pageConnections:
 An 8 Segment LED Bar Display uses 8 contiguous I/O lines.  These 8 I/O Lines are specified with the IOGroup property.  Each I/O line needs to be attached to a resistor and then to the appropriate pin on the display.
8 Segment LED Bar Display.

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oChaser4Controls a series of chasing lights.B2C1
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.