oA2D10 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 10-Bit resolution.

The following table lists the size and availability of the oA2D10 Object.
 ObjectSizeDescriptionA1A2B1B2C1
oA2D103 BytesA Hardware Object that measures the level of a voltage.xx
Back to top of pageOperation:
 

An oA2D10 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 oA2D10 Object. When set to 1 the oA2D10 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 oA2D10 Object enters a dormant state thus leaving the Level property at the value of the last conversion.

When created, the oA2D10 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 oA2D10 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 oA2D10 Object:

Property

Description

Level
A value that indicates the measured analog level.
Object Class: oValue Value Range: 0 - 1023 or 1020*
Data Type: Numeric (Read-Only) Default Value: 0
Note that for firmware B.2.0, the least significant 2-Bits will always read 0.  Only firmware versions B.2.0-Plus use a PIC that has the necessary hardware to populate the least significant 2-Bits with valid data.

The following table list the values of the Level property.
ValueDescription
0

The input voltage is 0 volts.

1 - 1022

The input voltage is a percentage of the reference voltage.

*1020The input voltage = the reference voltage for firmware version B.2.0. 
When using firmware versions B.2.0, the least significant 2-Bits will read 0 resulting in 1020 being the highest number that the oA2D10 Object can produce.
1023

The input voltage = the reference voltage for firmware version B.2.0-Plus

IOLine
A value that specifies which I/O Line is used to measure the analog signal.
Object Class: oIOLineA Value Range: 0 - 7
Data Type: Numeric Default Value: 0
The following table list the values of the IOLine Property.
IOLineDescription
0

The instance of the oA2D10 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 measure 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 oA2D10 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 
' 16 I/O lines.

Dim A As New oA2D10
Dim B As New oDIO16

Sub Main()
  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 
// 16 I/O lines.

oA2D10 A = New oA2D10;
oDIO16 B = New oDIO16;

Void Main(Void){
  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 oA2D10(1,cvOn)
B As oDIO16(cvOutput)

Do
  B.State = A.Level
Loop
 

Back to top of pageRelated Items:

 The following table lists other objects with related functions.
 ObjectDescriptionA1A2B1B2C1
oA2DControls the PIC's A2D Hardware Module.xxxxx
oA2D8Measures the level of the voltage on an input line with an 8-bit result.xxxxx
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 B.2.0: Introduced. (the least significant 2-Bits will always read 0)
firmware Ver B.2.0-Plus: Uses a PIC that has the necessary hardware to populate the least significant 2-Bits with valid data.

Bugs: No known bugs.


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