oKnob Object

Main Index
Object List
Back to top of pageDescription:
 A Hardware Object that reads the position of a knob attached to a potentiometer.
 The following table lists the size and availability of the oKnob Object.
 ObjectSizeDescriptionA1A2B1B2C1
oKnob3 BytesReads the position of a Knob.xxx
Back to top of pageOperation:
 An oKnob Object continuously updates the Position property with the position read from a knob attached to a potentiometer as long as long as the Operate property is set to 1.  When the Operate property is cleared to 0, the Position property is no longer updated and thus will not change.  The position range is from 0 to 255.  When the knob is turned all the way towards the side that is connected to ground then the position reads 0.  When the knob is turned all the way towards the side connected to 5 volts, the position reads 255.  And when the knob is in the center the position reads 128.

The IOLine property specifies the I/O line that will be used to read the position. 

The A2D property is an instance of the oA2D8 object which is created when the oKnob object is.  The oKnob object configures the A2D8 object in such a way that it can read the potentiometer's position.  Attributes of the oA2D8 Object's operation can be adjusted by directly manipulating it, but note that doing so may change the way the knob gets read to something different than the way described in this document.  (see oA2D8 object for more detail)

Back to top of pageProperties:

The following table lists the properties of the oKnob Object:

Property

Description

Position
A value that indicates the knob's position.
Object Class: oByte Value Range: 0 - 255
Data Type: Numeric Default Value: 0
IOLine
A value that specifies which I/O Line is used to read the knob's position.
Object Class: oIOLineA Value Range: 0 - 7
Data Type: Numeric Default Value: 0
Operate
A value that selects whether or not the knob's position is being read.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOff

The knob's position is not being read.

1cvOn

The knob's position is being read.

A2D
The I/O function object used to read the knob's position.
Object Class: oA2D8 Value Range: 0 - 7
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 Example:

The following examples use the oKnob Object.
Visual Basic SyntaxC and Java Syntax
' This program reads a knob
' and sets a 7-segment display.

Dim D As New o7Seg
Dim K As New oKnob

Sub Main()
  K.IOLine = 1
  K.Operate = cvOn
  D.IOGroup = 3
  D.Operate = cvOn
  Do 
    D.Value = K.Position / 27
  Loop
End Sub 
// This program reads a knob
// and sets a 7-segment display.

o7Seg D = New o7Seg;
oKnob K = New oKnob;

Void Main(Void){
  K.IOLine = 1;
  K.Operate = cvOn;
  D.IOGroup = 3;
  D.Operate = cvOn;
  Do { 
    D.Value = K.Position / 27;
  } While (1);
}
Basic Syntax 
' This program reads a knob
' and sets a 7-segment display.

D As o7Seg(3,,cvOn)
K As oKnob(1,cvOn)

Do 
  D.Value = K.Position / 27
Loop
 
Back to top of pageConnections:
 A potentiometer uses one I/O line.  The I/O Line is specified by the IOLine property.
Connections for knob attached to a potentiometer.

Back to top of page Related Items:
 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oKnobXReads the position of a Knob with a signed value.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.