oRepeat Object

Back to top of page Description:
 A Processing Object that provides an auto-repeat function.
 The following table lists the size and availability of the oRepeat Object.
 ObjectSizeDescriptionA1A2B1B2C1
oRepeat7 BytesProvides a repeat function.xxx
Back to top of page Operation:
 

The oRepeat Object monitors the value of the oLogic Object pointed to by the Input property. 

When the Input value transitions to the active state, which is specified by the InvertIn property, the Result property is set to 1 and a timer is started which counts in 1/60th of a second increments.  When the timer's value reaches the value specified by the Period property, then the Result property is cleared to 0 and the repeat function is started.  The repeat function then cycles the Result property at a rate specified by the Rate property which is also in 1/60th of a second increments. 

When the Input value transitions to an inactive state, the Result property is cleared to 0 and the Object restarts the operation.

The Operate property determines if operation is active and the Result property is updated. Each time the Result property is updated, its value is also copied to the oLogic property of the Object pointed to by the Output property. If the InvertOut property is set to 1, then the value of the Result property is inverted before it is copied.

Back to top of page Properties:

The following table lists the properties of the oRepeat Object:

Property

Description

Operate
A value that selects whether or not the data is updated.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe operation is not performed.
1cvOnThe operation is performed.
Input
A pointer to an oLogic Object whose value will be used to trigger the repeating output.
Object Class: oLogicPtrI Value Range: Any oLogic Object
Data Type: Pointer Default Value: Null
InvertIn
A value that selects if the value of the Input object is inverted before it is used in the repeat function.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
InvertInConstantDescription
0cvFalse

The value of the oLogic Object pointed to by the Input property is active when it transitions from 0 to 1.

1cvTrueThe value of the oLogic Object pointed to by the Input property is active when it transitions from 1 to 0.
Output
A pointer to an oLogic Object which will be updated with the result of the repeat operation.
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 stored into the Output object.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
InvertOutConstantDescription
0cvFalse

The value of the Result property is copied to the oLogic Object pointed to by the Output property.

1cvTrue

The value of the Result property is inverted before it is copied to the oLogic Object pointed to by the Output property.

Period
A value that specifies the amount of time in 1/60th of a second increments to wait after the Input value has changed to a logical High state.  After this amount of time, the repeating begins.
Object Class: oVar7 Value Range: 0 - 127
Data Type: Numeric Default Value: 0
Rate
A value that specifies the repeat cycle time in 1/60th of a second increments.
Object Class: oVar7 Value Range: 0 - 127
Data Type: Numeric Default Value: 0
Result
The Boolean result of the repeat function.
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, a Virtual Circuit is created that uses the oRepeat Object to monitor a push button switch on I/O line 8.  When the button is pressed, it turns on I/O line 9 for 1 second, then if the button stays presses for more than 1 second, it toggles the I/O line at a rate of 3 times per second.
Dim R As New oRepeat
Dim S As New oDIO1
Dim L As New oDIO1

Sub Main()
  ooPIC.PullUp = 1
  S.IOLine = 8
  S.Direction = cvInput
  L.IOLine = 9
  L.Direction = cvOutput
  L.Value = 0
  R.Input.Link(S)
  R.InvertIn = cvTrue
  R.Output.Link(L)
  R.Period = 60
  R.Rate = 20
  R.Operate = cvTrue
End Sub

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oDebounceProvides logic-state debouncing functions.xxxxx
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.