oChanged Object
An Object that indicates when an Object's value has changed.
Description:
A Processing Object that detects when an Object's Value property has changed. The oChanged Object takes the Value property of the Object to which the Input property links and compares it to the Value property of the Object to which the Output property links. Once the comparison is made, the input value is copied to the output value.
Operation:
 

The oChanged Object takes the Value property of the Object to which the Input property links and compares it to the Value property of the Object to which the Output property links.  If the two values are different, then the Changed property is set to 1; otherwise, it is cleared to 0.  After the comparison is made, the input value is copied to the output value.  If the input value does not change by the next time that the oChanged Object evaluates it, then the Changed property will have been set to 1 for one Object list loop.

Normal operation of the oChanged Object is to take the input value and compare and copy it to the output value 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 pointed to by the ClockIn property transitions in the manner specified by the InvertC property.

An 8-Bit signed Value property can be substituted for the Output property by specifying the appropriate property option.

Property Options:
 The oChanged Object has 4 variants which are selected with the 2 property options: O and C.  
  • O specifies that the Output property is replaced with a Value property.
  • C specifies that the ClockIn and InvertC properties are added.
 Continuous
operation
Clocked
operation
Pointers for both input and output:oChangedoChangedC
Signed 8-Bit Value on output:oChangedOoChangedOC
Storage size & Availability:
 The following table lists the size and availability of the oChanged Object and its variants:
ObjectSizeVersion
oChanged3 BytesB.1.0
oChangedO4 Bytes
oChangedC5 Bytes
oChangedOC
Properties:

The following table lists the Properties of the oChanged Object:
Address

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

Data-Type: Address, Read-Only

Data-Range: 0 - 127

Changed

A value that indicates if the value of the input object has changed.

Data-Type: Bit, Flag

Data-Range: 0 - 1

ValueConstantDescription
0cvFalseThe value of the input Object has not changed since the last Object list loop
1cvTrueThe value of the input Object has changed since the last Object list loop
ClockInA pointer to an Object's flag property that will be used to determine when the Object performs its function.

Data-Type: Flag-Pointer

Data-Range: 0 - 127

Availability: oChangedC oChangedOC

Direction

A value that indicates if the change was greater than or less than the previous value.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Input

A pointer to an Object whose value will be monitored for change by comparing it to the value of the Output object.

Data-Type: Number-Pointer

Data-Range: 0 - 127

InvertCA value that specifies the active transition state of the flag property to which ClockIn points.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Availability: oChangedC oChangedOC

ValueConstantDescription
0cvFalseThe compare and copy function is performed when the Flag property to which the ClockIn property links transitions from 0 to 1 
1cvTrueThe compare and copy function is performed when the Flag property to which the ClockIn property links transitions from 1 to 0
Operate

A value that specifies if the evaluation will take place.

Data-Type: Bit, Flag, Default

Data-Range: 0 - 1

Output

A pointer to an Object whose value will be used to track the last value of the Input object.

Data-Type: Number-Pointer

Data-Range: 0 - 127

Availability: oChanged oChangedC

ValueA signed 8-Bit value that can be on the output of the oChanged Object.

Data-Type: Byte

Data-Range: -128 to +127

Availability: oChangedO oChangedOC

Example:
 In the following example, a Virtual Circuit is created that uses the oChanged Object to detect when a different key on a keypad has been pressed.  When it detects this, a short tone is produced.
' When different buttons on a keypad
' are pressed, Make a short sound.

Dim C As New oChangedO
Dim K As New oKeyPad
Dim B As New oBusIC
Dim Y As New oCountDownO
Dim T As New oTone
Dim W As New oWire

Sub Main()
  K.Operate = cvTrue
  C.Input.Link(K)
  C.Operate = cvTrue
  B.Value = 6
  B.ClockIn.Link(C.Changed)
  B.Operate = cvTrue
  B.Output.Link(Y)
  Y.ClockIn.Link(OOPic.Hz60)
  Y.Operate = cvTrue
  W.Input.Link(Y.NonZero)
  W.Output.Link(T.Operate)
  W.Operate = cvTrue
  T.Value = 120
  T.IOLine = 24
End Sub
See Also:
 

oBus - An Object that copies values from one Object to another.