oCounter2L Object

Back to top of page Description:
 A Hardware Object that counts the pulses on input.
 The following table lists the size and availability of the oCounter2L Object.
 ObjectSizeDescriptionA1A2B1B2C1
oCounter2L6 BytesAn Object that counts the number of low-speed cycles on two inputs.xxx
Back to top of page Operation:
 

The oCounter2L Object monitors the inputs to the two I/O lines specified by the IOLine1 and IOLine2 properties and will increment or decrement the Position property as the two inputs change. 

The oCounter2L Object evaluates the two inputs as follows: The first Input line is used as a clock while the second I/O line is used as a direction input.  This results in a single count for each time the first input changes.  The direction of this count is determined by the state of the second input. If the second input is the same as the first, then the Count property is incremented.  If the second input is different than the first, then the Count property is decremented.  Each time the count changes, the Direction property is updated with the direction of the change and the Moved property is set.

Back to top of page Properties:

The following table lists the properties of the oCounter2L Object:

Property

Description

Count
A value that indicates how many pulse have been counted.
Object Class: oWord Value Range: 0 - 65535
Data Type: Numeric Default Value: 0

A value that indicates the position of the quadrant encoder.
If the second input is the same as the first, then the Count property is incremented.  If the If the second input is different than the first, then the Count property is decremented

Direction
A value that indicates the direction of the last count.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
A value that indicates the direction of the last movement.  This value is updated each time the Count property is changed. 
ValueDescription
0The last change to the Count property was an increment.
1The last change to the Count property was a decrement.
Changed
A value that indicates that the count has Changed. Valid for 1 link list loop.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0

This value is updated each time Count property changes at which time it is set to cvTrue.

In firmware B.x this value is valid for one link list loop.
In firmware C.x this value is User-Cleared.

IOLine1
A value that specifies which I/O Line is used for the first input.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
IOLine2
A value that specifies which I/O Line is used for the second input.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
InvertD
A value that selects if the count direction of the Count property and the Direction property will be reversed.
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
ValueDescription
0The Count property is incremented when the first input changes to the same state as the second input.
1The Count property is decremented when the first input changes to a different state as the second input.
Operate
A value that selects whether or not the cycles on the inputs are read.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe counter does not count the cycles on the input.
1cvOnThe counter counts the cycles on the input.
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 oCounter2L Object is used.
'This program reads an oCounter2L Object
'and outputs the value on I/O lines 8 - 15.

Dim A As New oCounter2L 
Dim B As New oDIO8

Sub Main()
  ooPIC.PullUp = 1
  A.IOLine1 = 8 
  A.IOLine2 = 10 
  A.Operate = cvTrue
  B.IOGroup = 3
  B.Direction = cvOutput
  Do
    B=A
  Loop
End Sub

Back to top of page Related Items:

 The following table lists objects that use the oCounter2L Object.
 ObjectDescriptionA1A2B1B2C1
oQEncodeReads a Quadrant Encoder.xxx
 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.

B.1.0: Introduced.
B.2.0: InvertD property added.
C.1.0: Moved property changed to User-Cleared.

Bugs: No known bugs.


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