oClock Object

Back to top of page Description:
 An Processing Object that provides a programmable logic clock.
 The following table lists the size and availability of the oClock Object.
 ObjectSizeDescriptionA1A2B1B2C1
oClock5 BytesProvides a programmable logic clockxxx
Back to top of page Operation:
 

The oClock Object takes a frequency of 283Hz and divides it by a value determined by subtracting the Rate property from 256.  [Freq = 283 / (256-Rate)]  It then updates the Result property with the resulting clock.  The Output property can be used to copy the value of the Result property to an oLogic Object.

The Rate property is a clock divider value that specifies the frequency. 

The Rate can be calculated for the desired frequency using the following formula: Rate  = [256 - (283 / Frequency)

The lowest frequency that can be generated is 1.1Hz  [Freq = 283 / (256-0)]
The highest frequency that can be generated is 283Hz  [Freq = 283 / (256-255)]

If the Shape property is set to 1, then the duration of the high-going portion of the clock cycle will only last for 1 Object List Loop.  By setting the InvertOut property to 1, this can be switched so that the low-going portion of the clock cycle will only last for 1 Object List Loop.

Back to top of page Properties:

The following table lists the properties of the oClock Object:

Property

Description

Operate
A value that selects if the clock input is evaluated or not.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOff

The clock input is not evaluated.

1cvOn

The clock input is evaluated.

Rate
A value that specifies an 8-Bit divisor to a fixed frequency of 283Hz.
Object Class: oVar8 Value Range: 0 - 255
Data Type: Numeric Default Value: 0
Determines the frequency using the following formula: Frequency = (283 / (256 - Rate))
RateDescription
0The square wave is disabled.
1The square wave is generated at 1.1Hz.
2-254The square wave is generated at the specified frequency.
255The square wave is generated at 283Hz.
Output
A pointer to oLogic Object which will be 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 Output oLogic Object.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
InvertOutDescription
0The value is not inverted before it is copied.
1The value is inverted before it is copied.
Shape
A value that selects how the clock's waveform is shaped. (Square or Pulse)
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Specifies how long the high-going pulse will last. (pulse on/off go high once go low once)
InvertOutDescription
0Square Wave.
1Pulse Wave.
Result
A value that indicates the resulting clock's waveform.
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 Examples:
 In the following example, the oClock Object is used to
Visual Basic SyntaxC and Java Syntax
'This program sets up an 
'oClock Object that cycles 
'three times every second.

Dim A As New oClock
Dim B As New oDIO1

Sub Main()
  A.Rate = 162
  A.Output.Link(B)
  A.Operate = cvTrue
  B.IOLine = 8
  B.Direction = cvOutput
End Sub
//This program sets up an 
//oClock Object that cycles 
//three times every second.

oClock A = New oClock;
oDIO1 B = New oDIO1;

Void Main(Void){
  A.Rate = 162;
  A.Output.Link(B);
  A.Operate = cvTrue;
  B.IOLine = 8;
  B.Direction = cvOutput;
}
Basic Syntax 
'This program sets up an 
'oClock Object that cycles 
'three times every second.

A As oClock
B As oDIO1

A.Rate = 162
A.Output.Link(B)
A.Operate = cvTrue
B.IOLine = 8
B.Direction = cvOutput
 

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oTimerControls the PIC's Timer1 Hardware Module.xxxxx
oFreqHOutputs a high frequency square wave using hardware specific I/O lines.xx
oFreqLOutputs a low frequency square wave on any I/O line.xxx
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.