oCountDown Object

Back to top of page Description:
 A Processing Object that decreases a value until that value is zero.
 The following table lists the size and availability of the oClock Object.
 ObjectSizeDescriptionA1A2B1B2C1
oCountDown6 BytesCounts down to 0.xxx
oCountDownO6 BytesCounts down to 0.xxx
Back to top of page Operation:
 

The oCountDown Object monitors a value to and determine whether it is greater than zero. 

If it is zero, then the Counting property is cleared.  If it is greater than Zero, then the Counting property is set and the value is decreased until it is.  When the value is being decreased, the oLogic Object pointed to by the ClockIn property is used as a clock signal that will decrement the value of the Object that the output property points to by 1 for each clock cycle.

The PreScale property is used to divide the ClockIn cycle rate.  If PreScale is set to a value greater than 0, then the ClockIn cycle rate will be divided by that number + 1.  For example, if the ClockIn property is linked to ooPIC.Hz60 and the PreScale property is set to 59, then the count down rate will be once every second.

The value that is decremented can be either the oValue Object that the Output property points to or the Value property.  Which one of the two that gets decremented is determined by the property option that is used.

Back to top of pageProperty Options:
 The oCountDown Object has 1 variant which is selected with the property option O.
  • "O" specifies that the Output property is replaced with a Value property.
Output property points to the value to decrement.oCountDown
8-Bit value is decrement:oCountDownO
Back to top of page Properties:

The following table lists the properties of the oCountDown 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
0cvOff

The Value property is not updated.

1cvOn

The Value property is updated.

Value
A value that will be decremented down to zero.
Object Class: oByte Value Range: 0 - 255
Data Type: Numeric Default Value: 0
Availability: oCountDownO
Output
A pointer to an oValue Object whose value is decrement down to zero.
Object Class: oValuePtrO Value Range: Any oValue Object
Data Type: Pointer Default Value: Null
Availability: oCountDown
ClockIn
A pointer to an oLogic Object whose value is used as a clocking signal which is then used to decrement the value.
Object Class: oLogicPtrI Value Range: Any oLogic Object
Data Type: Pointer Default Value: Null
Whether or not to decrement on the rising edge or the falling edge of the ClockIn value is determined by the InvertC property.
InvertC
A value that selects whether or not to invert the ClockIn object's value.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
InvertCDescription
0The value is decremented on the rising edge of the ClockIn value.
1The value is decremented on the falling edge of the ClockIn value.
PreScale
A value that specifies how many times to divide the clock rate.
Object Class: oVar7 Value Range: 0 - 127
Data Type: Numeric Default Value: 0
PreScaleDescription
0The value is decremented once for each cycle of the ClockIn value.
1 - 127Decremented once (each cycle of the ClockIn value / (PreScale +1)).
Counting
A value that indicates that the value being decremented is more than zero and the counter is currently decrementing it towards zero.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
CountingDescription
0The value is 0 and therefore is not being decremented.
1The value is > 0 and the count-down counter is running.
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 oCountDown Object.
Visual Basic SyntaxC and Java Syntax
'This program creates a Virtual 
'Circuit that will count down 
'from what ever number to which 
'B is assigned.

Dim A As New oCountDown
Dim B As New oDIO8

Sub Main()
  A.Output.Link(B)
  A.PreScale = 59
  A.ClockIn.Link(ooPIC.Hz60)
  A.Operate = 1
  B.IOGroup = 3
  B.Direction = cvOutput
  B = 5
End Sub
//This program creates a Virtual 
//Circuit that will count down 
//from what ever number to which 
//B is assigned.

oCountDown A = New oCountDown;
oDIO8 B = New oDIO8;

Void Main(Void){
  A.Output.Link(B);
  A.PreScale = 59;
  A.ClockIn.Link(ooPIC.Hz60);
  A.Operate = 1;
  B.IOGroup = 3;
  B.Direction = cvOutput;
  B = 5;
}
Basic Syntax 
'This program creates a Virtual 
'Circuit that will count down 
'from what ever number to which 
'B is assigned.

A As oCountDown
B As oDIO8

A.Output.Link(B)
A.PreScale = 59
A.ClockIn.Link(ooPIC.Hz60)
A.Operate = 1
B.IOGroup = 3
B.Direction = cvOutput
B = 5
 

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oCounterProvides counting 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.