oByte Object

Main Index
Object List
Back to top of page Description:
 The oByte Object manages an 8-Bit variable that can be used in a virtual circuit.  As well as the value of the variable, status properties are also provided that can be used in a virtual circuit.

There are three main differences between this object and a standard Byte variable. 

  1. This Object's Value property is an instance of the oValue Object which can be pointed to by a Virtual Circuit. 
  2. This Object maintains status bits which can be pointed to by Virtual Circuits.
  3. This Object is 1 byte larger in order to store the status information.
 The following table lists the size and availability of the oByte Object.
 ObjectSizeDescriptionA1A2B1B2C1
oByte2 BytesManages a value with a range of 0 to 255.xxxxx
Back to top of page Operation:
 An oByte Object variable stores an 8-Bit value in its Value property and maintains other values that represent the status of those 8 bits.

The MSB property indicates the Most-Significant-Bit of the value which can be used to indicate when the value is more than half.

The NonZero Property indicates if the value is not zero.

Back to top of page Properties:
 

The following table lists the properties of the oByte Object:

Property

Description

Value
The value of the 8-bit variable
Object Class: oValue Value Range: 0 - 255
Data Type: Numeric Default Value: 0
MSB
Indicates the Value property is more than half its range.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0

The MSB property reflects the most significant bit (MSB) of the oByte Object's Data property and therefore is updated when either the Value property or the Data property is written to.  Any writes the the MSB property will result in changing the most significant bit of the Data property. 

Notes on virtual circuit usage: Not all implementations of the oByte Object have a linkable MSB property.  While all instance of the oByte Object that you create in your programs will have a linkable MSB property,  some of the ooPIC Objects create a custom oByte Object instance that cannot.  For instance, the oTimer Object's instance of the oByte Object has a MSB property that cannot be linked to a virtual circuit.  To tell if an ooPIC Object's implementation of the oByte Object has a linkable MSB property, look for the oLogic class type in the Object browser when you expand the oByte instance.  If the MSB property is a oProperty class instead then it cannot be linked.
MSBDescription
0

The Value property is 127 or less (Less than half)

1

The Value property is 128 or more (more than half)

NonZero
A value that indicates the Value property is more than zero.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
The NonZero property is updated when the Value property is written to.  Any modifications that are made directly to the Data property will have no effect on the NonZero property.
Notes on virtual circuit usage: Not all implementations of the oByte Object have a linkable NonZero property.  While all instance of the oByte Object that you create in your programs will have a linkable NonZero property,  some of the ooPIC Objects create a custom oByte Object instance that cannot.  For instance, the oTimer Object's instance of the oByte Object has a NonZero property that cannot be linked to a virtual circuit.  To tell if an ooPIC Object's implementation of the oByte Object has a linkable NonZero property, look for the oLogic class type in the Object browser when you expand the oByte instance.  If the NonZero property is a oProperty class instead then it cannot be linked.
NonZeroConstantDescription
0cvFalse

The Value property is zero.

1cvTrue

The Value property is not zero.

Data
The data for the Value property.
Object Class: oVar8 Value Range: 0 - 255
Data Type: Numeric Default Value: 0
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 Methods:
 

The following table lists the Methods of the oByte Object
MethodDescription
Value.Clear

Clears the Value property to 0.

Value.Dec

Decrements the Value property by 1.

Value.Inc

Increments the Value property by 1.

Value.Invert

Inverts the bits in the Value property

Value.LShift

Shifts the bits in the Value property left.

Value.RShift

Shifts the bits in the Value property Right.

Value.Set

Sets the Value property to 255.

InitInitializes the properties.

Back to top of page Example:
 In the following example, a Virtual Circuit is created that outputs the status properties.
Visual Basic SyntaxC and Java Syntax
' This program creates a Virtual
' Circuit that connects the oByte's
' NonZero and MSB properties to 
' Digital Outputs.  Starting from a 
' value of 10, it decreases the  
' oByte's Value property every  
' 1/10 of a second.

Dim V As New oByte
Dim W1 As New oWire
Dim W2 As New oWire
Dim L1 As New oDIO1
Dim L2 As New oDIO1

Sub main() 
  L1.IOLine = 8
  L1.Direction = cvOutput
  W1.Input.Link(V.NonZero)
  W1.Output.Link(L1.State)
  W1.Operate = cvOn
  L2.IOLine = 10
  L2.Direction = cvOutput
  W2.Input.Link(V.MSB)
  W2.Output.Link(L2.State)
  W2.Operate = cvOn
  V = 10
  Do
    V.Value.Dec
    Delay = 100
  Loop 
End Sub
// This program creates a Virtual
// Circuit that connects the oByte's
// NonZero and MSB properties to
// Digital Outputs.  Starting from a
// value of 10, it decreases the
// oByte's Value property every
// 1/10 of a second.

oByte V = New oByte;
oWire W1 = New oWire;
oWire W2 = New oWire;
oDIO1 L1 = New oDIO1;
oDIO1 L2 = New oDIO1;

Void main(Void){
  L1.IOLine = 8;
  L1.Direction = cvOutput;
  W1.Input.Link(V.NonZero);
  W1.Output.Link(L1.State);
  W1.Operate = cvOn;
  L2.IOLine = 10;
  L2.Direction = cvOutput;
  W2.Input.Link(V.MSB);
  W2.Output.Link(L2.State);
  W2.Operate = cvOn;
  V = 10;
  Do{
    V.Value.Dec;
    Delay = 100;
  } While (1);
}
Basic Syntax 
' This program creates a Virtual
' Circuit that connects the oByte's
' NonZero and MSB properties to 
' Digital Outputs.  Starting from a 
' value of 10, it decreases the  
' oByte's Value property every  
' 1/10 of a second.

V Var oByte(10)
W1 Var oWire(V.NonZero,,L1.State,,cvOn)
W2 Var oWire(V.MSB,,L2.State,,cvOn)
L1 Var oDIO1(8,cvOutput)
L2 Var oDIO1(10,cvOutput)

Do
  V.Value.Dec
  Delay = 100
Loop 
Back to top of page Related Items:
 The following table lists some of the objects that use the oByte Object.
 ObjectDescriptionA1A2B1B2C1
oA2DControls the PIC's A2D Hardware Module.xxxxx
oDIO8BProvides an 8 line digital I/O with Blanking and Invert.x
oKeypad2Reads a Keypad matrix of up to 8 x 8.xx
oKnobReads the position of a Knob.x
oLCDControls a LCD Display.xxx
oServoControls an RC Servo-motor.xxxxx
oToneAn Object that outputs a tone.xxx
oUVTronHMReads a Hamamatsu UVTron Flame detector.xxx
 The following table lists other objects with related functions.
 ObjectDescriptionA1A2B1B2C1
oBitManages a 1-bit value with a range of 0 to 1.xxxxx
oNibManages a 4-bit value with a range of 0 to 15.xxxxx
oNibXManages a 4-bit signed value with a range of -8 to +7.x
oCharManages a 8-bit signed value with a range of -128 to -127.xxx
oWordManages a 16-bit value with a range of 0 to 65,535.xxxxx
oIntManages a 16-bit signed value with a range of -32,768 to +32,767.xxx
oBuffer(1-32)32 Objects that Manage various sized data-buffer/string variable.xxxxx
Back to top of page Version History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


 

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