oA2D10 Object
An Object that provides a 10-Bit numerical measurement of a voltage.
Description:
 

A Hardware Object that takes an analog voltage presented to one of the OOPic's I/O lines and converts it to a digital value.

Operation:
 

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 Value property with the generated value.

The IOLine property specifies which one of four analog enabled Input Lines on the OOPic to use. If the IOLine property is set to 0 then the instance of the oA2D10 Object is dormant.

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 Value property with the result. When the Operate property is cleared to 0 the oA2D10 Object enters a dormant state thus leaving the Value property at the value of the last conversion.

The ExtVRef property of the OOPic Object determines the analog reference voltage which is selectable to either +5 volts or the voltage level supplied on the OOPic’s I/O line 4. If the ExtVRef property is set to 0 then +5 volts is used as the reference voltage. If the ExtVRef property is set to 1 then the voltage applied to the OOPic’s I/O Line 4 is used as the maximum voltage in the voltage conversion range. The maximum voltage allowed on I/O Line 4 is 14-Volts DC.

Each dimensioned instance of an oA2D10 Object shares the analog-to-digital converter (A/D) module which converts the analog input signals to a corresponding digital number with all of the other Analog to Digital Objects. The A/D module has seven analog inputs available on the OOPic’s I/O lines 1 - 7 which are multiplexed into a single sample and hold register. The sample and hold register is the input into the A/D module which generates the result via successive approximation.

The analog-to-digital conversion process takes approximately 14µs. Each dimensioned instance of an Analog to Digital Object with an Operate property set to 1 will in turn request an analog-to-digital conversion be done on the voltage present on the I/O line specified in the Analog to Digital Object’s IOLine property. When the conversion is completed the resulting value will be placed in the Objects Value property and the next Analog to Digital Object instance will follow the same until all active Analog to Digital Object instances have been addressed. After the last Analog to Digital Object instance has been addressed the process begins again with the first Analog to Digital Object instance. With all 7 possible Analog to Digital Object instances dimensioned and all 7 Operate properties set to 1 the entire conversion process takes 98µs.

Remarks:
 

When any Analog to Digital Object is in use, I/O lines 1, 2, 3, and 4 are set to read an analog value, and any Digital-I/O Object using these I/O lines will read 0. If any Analog to Digital Object is set to use I/O Lines 5, 6, or 7, then all I/O lines 1 to 7 are set to read analog values.

Storage size & Availability:
 

The following table lists the size and availability of the oA2D10 Object.

ObjectSizeVersion
oA2D10 3 Bytes B.2.0  Note: The 2 least significant bits are only valid in firmware versions B.2.0-Plus.
Properties:
 

The following table lists the Properties of the oA2D10 Object
Property Description
Address

Returns a pointer to the address of the oA2D10 Object instance.

Data-Type: Number-Pointer Read-Only

Data-Range: 0 - 127

IOLine

The physical I/O Line number to use.

Data-Type: Nibble

Data-Range: 0 - 3 for firmware up to B.1.0,  0 - 7 for firmware B.2.0 and up.

History:  In firmware version B.2.0, this property was expanded to include I/O Lines 5, 6 and 7.

The following table list the values of the IOLine Property.
IOLine Constant Description
0  

The instance of the oA2D10 Object is dormant.

1 - 7  

The Analog signal on the specified IOLine is evaluated.

MSB

The Most-Significant-Bit of the Value property.

Data-Type: Bit Flag Read-Only

Data-Range: 0 - 1

The following table list the values of the MSB Property.
MSB Constant Description
0  

The input voltage is less than 1/2 the reference voltage.

1  

The input voltage is more than or equal to 1/2 the reference voltage.

Operate

A value that specifies whether or not the conversion is performed.

Data-Type: Bit Flag

Data-Range: 0 - 1

The following table list the values of the Operate Property.
Operate Constant Description
0 cvFalse

The Value property is not updated.

1 cvTrue

The Value property is updated.

String

The Value property represented as a string.

Note: The String property is available in OOPic Basic Version 2

Data-Type: String Read-Only

Value

The value returned by the Analog-To-Digital conversion for the specified I/O Line. 
Note that the least significant 2-Bits will always read 0 in firmware versions B.2.0, only firmware versions B.2.0-Plus have the necessary hardware to populate the least significant 2-Bits will valid data.

Data-Type: Byte Read-Only Default

Data-Range: 0 - 1023 or 1020*.

The following table list the values of the Value Property.
Object Value Constant Description
0  

The input voltage is 0 volts.

1 - 1022  

The input voltage is a percentage of the reference voltage.

*1020   The 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

Caution:
 

The maximum voltage allowed on I/O Line 4 is 14-Volts DC.

Example:
  In the following example uses the oA2D10 Object.
' This program reads the analog value from I/O line 1.
' and outputs its binary value to I/O lines 8-15 and 24-31.

Dim A As New oA2D10
Dim B As New oDio16

Sub Main()
  B.IOGroup = 1
  B.Direction = cvOutput
  A.IOLine = 1
  A.Operate = 1
  Do
    B.Value = A.Value
  Loop
End Sub 
See Also:
  oA2D - An Object that converts a voltage to an 8-Bit number.
oA2DX
- An Object that detects when an analog value has exceeded a threshold.