oCompare Object
An Object that compares one Object's Value property to another Object Value property.
Description:
 A Processing Object that takes the Value property of the Object to which an Input pointer points and compares it to the Value property of up to 2 Objects to which Reference pointers point.   
Operation:
 The oCompare Object takes the Value of the Object to which the input property links and performs 2 comparisons on it. These comparisons result in one of 3 properties (Above, Between and Below) to be set while the remaining two are cleared to 0.  The normal operation of the oCompare Object is to make these comparisons once every Object list loop.  If the property option "C" is used, then the operation is modified so that this function only occurs once each time the Flag-property to which the ClockIn property points transitions in the manner specified by the InvertC property.

In normal operation, the input value is first compared to the value of the Object linked to by the ReferenceIn1 property plus the value of the fuzziness property.  If the input value is greater than the ReferenceIn1 value plus the fuzziness value, then the Above property is set to 1.  If the input value is equal to or less than the ReferenceIn1 plus fuzziness value, then a second comparison is made where the input property is compared against the ReferenceIn1 value minus the fuzziness value. If the input value is less than the ReferenceIn1 value minus the fuzziness value, then the Below property is set to 1; otherwise, the Between property is set to 1.

Property options are also available that change the number of references with which the compare is made . When the property option "0" (zero) is specified, no reference pointers are used and the comparison is made against a value of 0.  When the property of "2" is used, the comparison is made against two references.

If the "0" (for zero references) property option is specified, then the oCompare Object operates as it does normally, except that the ReferenceIn1 value is replaced with 0.

If the "2" (for two references) property option is specified, then the oCompare Object operates as it does normally except that in the second comparison, the ReferenceIn1 property is replaced with a ReferenceIn2 property.

Property Options:
 The oCompare Object has 6 variants which are selected with 3 property options: 0, 2, and C.  
  • 0 (zero) specifies that the ReferenceIn1 property is replaced with a value of 0.
  • 2 specifies that the ReferenceIn2 property is added.
  • C specifies that the properties; ClockIn and InvertC are added.
 Continuous
operation
Clocked
operation
Compare is made with 1 reference:oCompareoCompareC
Compare is made with 0:oCompare0oCompare0C
Compare is made with 2 references:oCompare2oCompare2C
Storage size & Availability:
 The following table lists the size and availability of the oCompare Object and its variations:
ObjectSizeVersion
oCompare4 BytesB.1.0
oCompare0
oCompare25 Bytes
oCompareC6 Bytes
oCompare0C
oCompare2C7 Bytes
Properties:
 The following table lists the Properties of the oCompare Object:
PropertyDescription
AboveA value that indicates if the value property of the Object to which the Input property links is greater than the value of the Object to which the ReferenceIn1 property links plus the value specified by the Fuzziness property.

Data-Type: Bit, Flag

Data-Range: 0 - 1

AddressReturns a pointer to the address of the oCompare Object instance.

Data-Type: Address, Read-Only

Data-Range: 0 - 127

BelowA value that indicates if the value property of the Object to which the Input property links is lower than the values of the Objects pointed to by the References minus the value specified by the Fuzziness property.

Data-Type: Bit, Flag

Data-Range: 0 - 1

BetweenA value that indicates if the value property of the Object to which Input points is lower than the value of the Object pointed to by Reference 1 minus the value specified by the Fuzziness property and is higher than the value of the Object pointed to by Reference2 plus the value specified by the Fuzziness property.

In the case of oCompare0 and oCompare0C the between property indicates that the value property of the Object pointed to by Input is with the values of -Fuzziness and +Fuzziness.

Data-Type: Bit, Flag

Data-Range: 0 - 1

ClockInA pointer to an Object's flag property that will be used to determine when the oCompare Object performs its function.

Data-Type: Flag-Pointer

Data-Range: 0 - 127

Availability: oCompareC   oCompare0C oCompare2C

FuzzinessA value that specifies a dead area around the references in which the input value must pass before the Above or Below properties are set.

Data-Type: Byte

Data-Range: 0 - 127

InputA pointer to an Object whose value property is compared to the value properties of the Objects pointed to by ReferenceIn1 and ReferenceIn2.

Data-Type: Object-Pointer

Data-Range: 0 - 127

InvertCA value that specifies the active transition state of the flag property linked to by ClockIn.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Availability: oCompareC   oCompare0C oCompare2C

ValueConstantCopy is performed when then flag-property pointed to by ClockIn transitions
0 From 0 to 1 
1 From 1 to 0
OperateA value that specifies whether or not the values are compared.

Data-Type: Bit, Flag, Default

Data-Range: 0 - 1

ReferenceIn1A pointer to an Object whose value property is compared to the value property of the Object pointed to by Input.

Data-Type: Object-Pointer

Data-Range: 0 - 127

Availability: oCompare oCompareC oCompare2 oCompare2C

ReferenceIn2A pointer to an Object whose value property is compared to the value property of the Object pointed to by Input.

Data-Type: Object-Pointer

Data-Range: 0 - 127

Availability: oCompare2 oCompare2C

Example:
 In the following example the oCompare0 Object is used
'This program uses the oCompare0 
'Object to detect when a 
'compass is heading north; when
'it is, turn on a LED on I/O line 15

Dim X As New oCompassVX
Dim C As New oCompare0
Dim D As New oDio1
Dim W As New oWire

Sub Main()
  X.IOGroup = 3
  X.Operate = 1
  C.Input.Link(X)
  C.Fuziness = 15
  C.Operate = 1
  D.IOLine = 15
  D.Direction = cvOutput
  W.Input.Link(C.Between)
  W.Output.Link(D)
  W.Operate = 1
End Sub
Also See:
 oMath - An Object that compares two Object's values while performing a calculation on the.
oChanged - An Object that compares an Object's value to its last value.