oDivider Object
An Object that divides a clock by a specified divisor.
Description:
 

A Processing Object that takes a clock input, divides it by a specified divisor and provides a clock output with the newly calculated clock rate.

Operation:
 

The oDivider Object monitors the value of a Flag-property to which the ClockIn property links.  Each time the monitored value transitions from 0 to 1 or from 1 to 0, a half-tick is counted.  The number of  half-ticks is then compared to the number specified by the Rate property.  When the half-tick count is equal to the Rate property, the Result property is inverted. This process results in the Result property equaling the ClockIn frequency divided by the Rate property.  For example, if the ClockIn property is linked to a 60hz input and the Rate property is set to 1, then the Result property will also cycle at 60hz.  But if the Rate property is set to 3, then the Result will cycle at 20hz.  

If the Rate property is set to 0, then the Input clock is divided by 256.

The default value of the Rate property is 1.

Storage size & Availability:
 

The following table lists the size and availability of the oDivider Object:

ObjectSizeVersion
oDivider 5 Bytes B.1.0
Properties:
 

The following table lists the Properties of the oDivider Object:

Property Description
Address

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

Data-Type: Address, Read-Only

Data-Range: 0 - 127

ClockIn

A pointer to a Flag-Property whose value is used as an input to the divider function. 

Data-Type: Flag-Pointer

Data-Range: Any address of a Flag-Property.

InvertC

A value that specifies if the incoming clock signal is to be inverted.

Data-Type: Bit, Flag

Data-Range: 0 - 1

The following table lists the values of the InvertC Property:

InvertCConstantDescription
0 cvFalse A transition from 0 to 1 is considered the end of the input clock's cycle.
1 cvTrue A transition from 1 to 0 is considered the end of the input clock's cycle
InvertOut

A value that specifies if the value of the Result property is inverted before it is copied to the Flag-property linked to the Output property.

Data-Type: Bit, Flag

Data-Range: 0 - 1

The following table lists the values of the InvertOut property:

InvertOutConstantDescription
0 cvFalse The value Result property is not inverted.
1 cvTrue The value of the Result property is inverted before it is copied.
Operate

A value that specifies whether or not the ClockIn value is divided.

Data-Type: Bit, Flag, Default

Data-Range: 0 - 1

The following table lists the values of the Operate Property:

Operate Constant Description
0 cvFalse The data is not updated.
1 cvTrue The data is updated.
Output

A pointer to a Flag-Property whose value is updated with the value of the Result property.

Data-Type: Flag-Pointer

Data-Range: Any address of a Flag-Property.

Rate

A value that specifies the number of times that the ClockIn value is to be divided.

Data-Type: Byte

Data-Range: 0 - 127

Default-Value: 1

Rate Constant Description
0   Divide by 256
1 to 255   Divide by the number specified.
Result

The result of the divided ClockIn value.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Example:
  In the following example, a Virtual Circuit is set up that uses the oDivider Object to blink a light 3 times a second.
Dim A As New oDivider
Dim B As New oDio1

Sub Main()
  A.ClockIn.Link(OOPic.hz60)
  A.Rate = 20
  A.Output.Link(B)
  A.Operate = 1
  B.IOLine = 31
  B.Direction = cvOutput
End Sub
See Also:
 

oClock - An Object that provides a variable clock rate.