oA2D8 Object

Main Index
Object List
Back to top of pageDescription:
 

A Hardware Object that measures the level of a voltage on an input line with a 8-Bit resolution.

The following table lists the size and availability of the oA2D8 Object.
 ObjectSizeDescriptionA1A2B1B2C1
oA2D3 ByteA Hardware Object that measures the level of a voltage.xxxxx
Back to top of pageOperation:
 

An oA2D8 Object takes the voltage present on the I/O Line specified by the IOLine property and compares it to a reference voltage. It then generates a digital value which represents what percentage the voltage is of the reference voltage and updates its Level property with the generated value.

The IOLine property specifies which one of the analog enabled Input Lines to use.

An Operate property is provided to activate the oA2D8 Object. When set to 1 the oA2D8 Object continuously performs an analog-to-digital conversion of the voltage present on the I/O Line specified by the IOLine property and updates its Level property with the result. When the Operate property is cleared to 0 the oA2D8 Object enters a dormant state thus leaving the Level property at the value of the last conversion.

When created, the oA2D8 Object also creates an instance of the oA2D object which it uses to do the actual Analog-to-Digital conversion.  Most properties of the oA2D instance can be adjusted and will affect the oA2D8 object's operation such as Converter.ExtVRef which is used to specify an analog reference voltage.  See the oA2D Help for more detail on how analog signals are converted to values.

Back to top of pageProperties:
 

The following table lists the properties of the oA2D8 Object:

Property

Description

Level
The value returned by the Analog-To-Digital conversion for the specified I/O Line. 
Object Class: oByte Value Range: 0 - 255
Data Type: Numeric (Read-Only) Default Value: 0
LevelDescription
0

The input voltage is 0 volts.

1 - 254

The input voltage is a percentage of the reference voltage.

255

The input voltage = the reference voltage.

IOLine
A value that specifies which I/O Line is used to measure the analog signal.
Object Class: oIOLineA Value Range: 0 - 3 for firmware up to B.1.0,
 0 - 7 for firmware B.2.0 and up.
Data Type: Numeric Default Value: 0
History:  In firmware version B.2.0, this property was expanded to include I/O Lines 5, 6 and 7.
IOLineDescription
0

The instance of the oA2D8 Object is dormant.

1 - 7

The Analog signal on the specified IOLine is evaluated.

Operate
A value that selects whether or not the measurement is performed.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOff

The measurement is not performed.

1cvOn

The measurement is performed.

Converter
The PIC Hardware object used to convert the analog signal.
Object Class: oA2D Value Range: 0 - 7
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 pageExample:
 In the following example uses the oA2D8 Object.
Visual Basic Syntax C and Java Syntax
' This program reads the analog 
' value from I/O line 1 and 
' outputs its binary value to 
' 8 I/O lines.

Dim A As New oA2D8
Dim B As New oDIO8

Sub Main()
  B.IOGroup = 1
  B.Direction = cvOutput
  A.IOLine = 1
  A.Operate = 1
  Do
    B.State = A.Level
  Loop
End Sub
// This program reads the analog 
// value from I/O line 1 and 
// outputs its binary value to 
// 8 I/O lines.

oA2D8 A = New oA2D8;
oDIO8 B = New oDIO8;

Void Main(Void){
  B.IOGroup = 1;
  B.Direction = cvOutput;
  A.IOLine = 1;
  A.Operate = 1;
  Do{
    B.State = A.Level;
  }
} 
Basic Syntax 
' This program reads the analog 
' value from I/O line 1 and 
' outputs its binary value to 
' 16 I/O lines.

A As oA2D8(1,cvOn)
B As oDIO8(1,cvOutput)

Do
  B.State = A.Level
Loop
 
Back to top of pageRelated Items:
 The following table lists objects that use the oA2D8 Object.
 ObjectDescriptionA1A2B1B2C1
oKnobReads the position of a Knob.x
 The following table lists other objects with related functions.
 ObjectDescriptionA1A2B1B2C1
oA2DControls the PIC's A2D Hardware Module.xxxxx
oA2D10Measures the level of the voltage on an input line with an 10-bit result.xx
oA2DXMeasures the level of the voltage on an input line and detects when it has exceeded a threshold.xxx
Back to top of pageVersion History and Bug List:
 Firmware Ver A.1.0: Introduced.
Firmware Ver B.2.0: the IOLine property was expanded to include I/O Lines 5, 6 and 7.

Bugs: No known bugs.


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