oCompassVX Object

Back to top of page Description:
 A Hardware Object that reads a Vector 2X Compass Module and returns a URCP Heading value.
 The following table lists the size and availability of the oCompassVX Object.
 ObjectSizeDescriptionA1A2B1B2C1
oCompassVX9 BytesReads a Vector V2X Compass.xxx
Back to top of page Operation:
 

The oCompassVX Object uses the 5 I/O lines specified by the IOGroup property to read a Vector 2X Compass Module and return a URCP Heading value of -128 to +127.

Back to top of page Properties:
 

The following table lists the properties of the oCompassVX Object:

Property

Description

Heading
A value that indicates the current compass heading.
Object Class: oHeading Value Range: -128 to +127
Data Type: Numeric Default Value: 0
DirectionHeading


URCP Heading

N0
NE32
E64
SE96
S-128
SW-96
W-64
NW-32
IOGroup
A value that specifies which group of 8 I/O lines is connected to the Compass.
Object Class: oIOGroup Value Range: 0 - 3
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOGroup for details.
Operate
A value that selects whether or not the compass is being read.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe compass is not read.
1cvOnThe compass is read.
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 oCompassVX Object is used to detect the direction that the Vector 2X compass Module is facing and displays that direction as a binary number on I/O group 1.
Visual Basic Syntax C and Java Syntax
' This program reads a Vector 2X compass
' Module and displays the binary 
' result on I/O Lines 8 - 15.

Dim C As New oCompassVX
Dim D As New oDIO8
 
Sub Main()
  C.IOGroup = 3
  C.Operate = cvTrue
  D.IOGroup = 1
  D.Direction = cvOutput
  Do
    D.Value = C.Value
  Loop
End Sub
// This program reads a Vector 2X compass
// Module and displays the binary
// result on I/O Lines 8 - 15.

oCompassVX C = New oCompassVX;
oDIO8 D = New oDIO8;

Void Main(Void){
  C.IOGroup = 3;
  C.Operate = cvTrue;
  D.IOGroup = 1;
  D.Direction = cvOutput;
  Do{
    D.Value = C.Value;
  } While (1);
}
Basic Syntax 
' This program reads a Vector 2X compass
' Module and displays the binary 
' result on I/O Lines 8 - 15.

C As oCompassVX(3,cvon)
D As oDIO8(1,cvOutput)
 
D.IOGroup = 1
D.Direction = 
Do
  D.Value = C.Value
Loop
 
Back to top of page Connections:
 The oCompassVX uses 5 I/O lines.  The 5 I/O lines can be in I/O Group 1, 2, or 3 and are the first 5 lines of any of the 3 groups.
Vector 2X Compass ModuleSocket Wiring Diagram

PinNameDescriptionI/O BitIOGroup
123
P1SCLKSerial ClockBit-2101826
P2SDOSerial Data OutputBit-191725
P3SDISerial Data Input    
P4SSSlave SelectBit-081624
P5PCPoll / ContinuousBit-081624
P6CALCalibrate    
P7RESResolution    
P8M/SMaster / Slave    
P9BCD/BinBCD / Binary    
P10Y FlipFlip Y-axis    
P11X FlipFlip X-axis    
P12CICalibrate indicator    
P13EOCEnd of ConversionBit-3111927
P14RAWRaw data mode    
P15VCC+5 Volt power+5 Volts   
P16GNDPower ReturnGnd   
P17RESETResetBit-4122028

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oCompassDNReads a Dinsmore 1490 Compass.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.