oDivider Object

Back to top of pageDescription:
 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.
 The following table lists the size and availability of the oClock Object.
 ObjectSizeDescriptionA1A2B1B2C1
oDivider5 BytesProvides a clock divider.xxxxx
Back to top of pageOperation:
 

The oDivider Object monitors the oLogic Object that the Input property points to.  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 Input frequency divided by the Rate property.  For example, if the Input 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.

Back to top of pageProperties:

The following table lists the properties of the oDivider Object:

Property

Description

Operate
A value that selects whether or not the Input clock is divided.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe data is not updated.
1cvOnThe data is updated.
Input
A pointer to an oLogic Object whose value is used as an input to the divider function.
Object Class: oLogicPtrI Value Range: Any oLogic Object
Data Type: Pointer Default Value: Null
InvertIn
A value that selects in the incoming clock signal is to be inverted.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
The following table lists the values of the InvertIn Property:
InvertInConstantDescription
0cvFalseA transition from 0 to 1 is considered the end of the input clock's cycle.
1cvTrueA transition from 1 to 0 is considered the end of the input clock's cycle
Output
A pointer to an oLogic Object whose value is updated with the value of the Result property.
Object Class: oLogicPtrO Value Range: Any oLogic Object
Data Type: Pointer Default Value: Null
InvertOut
A value that selects if the value of the Result property is inverted before it is copied to the oLogic Object pointed to by the Output property.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
InvertOutConstantDescription
0cvFalseThe value Result property is not inverted.
1cvTrueThe value of the Result property is inverted before it is copied.
Rate
A value that specifies the number of times that Input clock is to be divided.
Object Class: oVar7 Value Range: 0 - 127
Data Type: Numeric Default Value: 1
RateDescription
0Divide by 256
1Output clock = Input Clock
2 to 255Divide by the number specified.
Result
The result of the divided Input clock.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Address
Returns a pointer to the address of the oCounter Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of page Example:

The following examples use the oDivider Object.
Visual Basic SyntaxC and Java Syntax
' This program generates a 3Hz Clock
' by using an oDivider to divide the
' ooPIC.Hz60 property by 20.

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 = 8
  B.Direction = cvOutput
  B.Value = 1
End Sub
// This program generates a 3Hz Clock
// by using an oDivider to divide the
// ooPIC.Hz60 property by 20.

oDivider A = New oDivider;
oDIO1 B = New oDIO1;

Void Main(Void){
  A.ClockIn.Link(ooPIC.Hz60);
  A.Rate = 20;
  A.Output.Link(B);
  A.Operate = 1;
  B.IOLine = 8;
  B.Direction = cvOutput;
  B.Value = 1;
}
Basic Syntax 
' This program generates a 3Hz Clock
' by using an oDivider to divide the
' ooPIC.Hz60 property by 20.

A As oDivider(ooPIC.Hz60,,B,,20,cvOn)
B As oDIO1(8,cvOutput,1) 

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oClockProvides a programmable logic clockxxx
Back to top of page Version History and Bug List:
 Firmware Ver B1: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.