oQencode Object

Back to top of page Description:
 A Hardware Object that reads a Quadrant Encoder wheel and counts up or down as it turns.
 The following table lists the size and availability of the oQencode Object.
 ObjectSizeDescriptionA1A2B1B2C1
oQencode6 BytesReads a Quadrant Encoder.xxx
Back to top of page Operation:
 

The oQEncode 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 two inputs are expected to be connected to a quadrant encoder but any quadrant style inputs will enable the oQEncode Object to operate correctly. 

The oQEncode 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 Position property is incremented.  If the second input is different than the first, then the Position 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 oQencode Object:

Property

Description

Position
A value that indicates the position of the encoder.
Object Class: oWord Value Range: 0 - 65535
Data Type: Numeric Default Value: 0
If the second input is the same as the first, then the Position property is incremented.  If the If the second input is different than the first, then the Position property is decremented.
Direction
A value that indicates the direction of the last movement.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
ValueDescription
0The last change to the Position property was an increment.
1The last change to the Position property was a decrement.
Moved
A value that indicates that the value has moved. Valid for 1 link list loop.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0

A value that specifies if the count has moved.  This value is updated each time the oQEncode Object evaluates the inputs and therefore each time the Position property changes, the Moved property 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 connected to the encoder's first sensor.
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 connected to the encoder's second sensor.
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 that the direction of the count is reversed.
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Availability: Version B.2.0.
ValueDescription
0The Position property is incremented when the first input changes to the same state as the second input.
1The Position 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 data is updated.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOff

The operation is not performed.

1cvOn

The operation is performed.

Counter
The I/O function object used to count the movements.
Object Class: oCounter2L Value Range: 0 - 65535
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 oQEncode Object is used.
'This program reads an oQencode Object
'and outputs the value on I/O lines 8 - 15.

Dim A As New oQencode 
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 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.