|
||
| Description: | ||||||||||||||||||||||||||||||||||||||||||
A Hardware Object that takes an analog voltage presented to one of the OOPic's I/O lines and converts it to a signed digital value. This Object is an expanded oA2D Object and has the additional functionality of shifting the resulting value so that part of the result is a negative number. Whether the value is negative or positive can be monitored and used to signal that a threshold has been passed. |
||||||||||||||||||||||||||||||||||||||||||
| 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. It then generates a digital value ranging from 0 to 255 which represents this voltage as a percentage of the reference voltage. This digital value is then split in two by subtracting 128. This results in voltage levels which are greater than half the reference voltage being represented as a positive number from 0 to 127, and voltage levels which are less than half the reference voltage being represented as a negative number from -1 down to -128. After the digital value is split, the value specified by the Center property is added, resulting in shifting where 0 shows up on the analog voltage range, and the final value is stored into the Value property. Because the Center property is used to shift where 0 shows up on the analog voltage range, the final range of the Value property is 256 steps within the range of -256 to +255. A Limit property is provided for the cases where this value needs to stay within the -128/+127 (8-Bits signed) range. When the Limit property is set to 1, values below -128 are set to -128 and any values above +127 are set to +127. For example, If the Center property is set to 10 and 5 volts is presented to the I/O line, then the resulting value would be +137. Setting the Limit Property to 1, would force that value back down to +127. 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. Each dimensioned instance of an oA2DX 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 oA2DX Object:
|
||||||||||||||||||||||||||||||||||||||||||
| Properties: | ||||||||||||||||||||||||||||||||||||||||||
The following table lists the Properties of the oA2DX Object:
|
||||||||||||||||||||||||||||||||||||||||||
| Example: | ||||||||||||||||||||||||||||||||||||||||||
In the following example the oA2DX Object is used.
|
||||||||||||||||||||||||||||||||||||||||||
| See Also: | ||||||||||||||||||||||||||||||||||||||||||
oA2D - An Object that provides a numerical measurement of a voltage. |
||||||||||||||||||||||||||||||||||||||||||