Description: |
| | A Hardware Object that measures the level of a voltage on an input line with a signed 8-Bit resolution. This object can be used to detect when an analog value has exceeded a threshold because the voltage level that is used as the dividing point between a positive result and a negative result can be adjusted. The following table lists the size and availability of the oA2DX Object.
| | Object | Size | Description | A1 | A2 | B1 | B2 | C1 |
 | oA2DX | 5 Byte | A Hardware Object that measures the level of a voltage. | x | x | x |
|
Operation: |
| | An oA2DX Object takes the voltage present on the I/O Line specified by the IOLine property and compares it to a reference voltage which generates a digital value ranging from 0 to 255 representing the voltage as a percentage of the reference voltage. This digital value is then split in two by subtracting 128. This results in positive numbers from 0 to 127 representing voltage levels which are greater than half the reference voltage, and negative numbers from -1 down to -128 representing voltage levels which are less than half the reference voltage. After the digital value is then split, the value of the Adjust property is added, resulting in shifting where a Level of 0 shows up on the analog voltage range. Because adding the Adjust property creates a final range of -256 to +255, the final value is adjusted so that values below -128 are set to -128 and any values above +127 are set to +127. For example, If the Adjust property is set to 10 and 5 volts is presented to the I/O line, then the resulting value would be +137 which would set the Level property to +127. When created, the oA2DX 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 oA2DX 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. |
Properties: |
| The following table lists the properties of the oA2DX Object:
|
Example: |
| | In the following example the oA2DX Object is used.
| Visual Basic Syntax | C and Java Syntax |
' This program reads an
' oA2DX Object and positions
' a servo based on it.
Dim A As New oA2DX
Dim S As New oServoX
Sub Main()
A.IOLine = 1
A.Operate = cvTrue
S.IOLine = 31
S.Operate = cvTrue
Do
S.Position = A.Level
Loop
End Sub | ' This program reads an
' oA2DX Object and positions
' a servo based on it.
oA2DX A = New oA2DX;
oServoX S = New oServoX;
Void Main(Void){
A.IOLine = 1;
A.Operate = cvTrue;
S.IOLine = 31;
S.Operate = cvTrue;
Do{
S.Position = A.Level;
}
} |
| Basic Syntax | |
' This program reads an
' oA2DX Object and positions
' a servo based on it.
A As oA2DX(1,,cvOn)
S As oServoX(31,,,,,,,cvOn)
Do
S.Position = A.Level
Loop |
|
|
Related Items: |
| | The following table lists objects that use the oA2DX Object.
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oCDS | Reads a CdS Cell. | x | x | x |
 | oIRRange | Reads a Sharp GP2D12 IR ranging module. | x | x | x |
 | oKnobX | Reads the position of a Knob with a signed value. | x |
|
| | The following table lists other objects with related functions.
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oA2D | Controls the PIC's A2D Hardware Module. | x | x | x | x | x |
 | oA2D10 | Measures the level of the voltage on an input line with an 10-bit result. | x | x |
 | oA2D8 | Measures the level of the voltage on an input line with an 8-bit result. | x | x | x | x | x |
|
Version History and Bug List: |
| | Firmware Ver B1: Introduced. Firmware Ver B2: The Adjust property was added.Bugs: No known bugs. |