| Description: |
| | A Hardware Object that reads a Vector 2X Compass Module and returns a URCP Heading value. |
| Operation: |
| | The oCompassVX Object uses the 5 I/O lines specified by the IOGroup property to read a Vector 2X Compass Module which returns a value of 0 - 359. Once the data read has been completed, the Scale property is checked. If it is 0, then the data is converted to an URCP Heading value. If the Scale is 1, then the value remains unchanged. Once the scale has been determined, the value is stored in the Value property. |
| Storage size & Availability: |
| | The following table lists the size and availability of the oCompassVX Object and its variations: | Object | Size | Version |
|---|
 | oCompassVX | 9 Bytes | B.1.0 |
|
| Properties: |
| | The following table lists the Properties of the oCompassVX Object: | Property | Description | | Address | Returns a pointer to the address of the oCompassVX Object instance. Data-Type: Address, Read-Only Data-Range: 0 - 127 | | IOGroup | A value that specifies which physical I/O Group to use. Data-Type: Nibble Data-Range: 0 - 3 | | NonZero | A value that indicates if the Value property is 0 or not. Data-Type: Bit, Flag Data-Range: 0 - 1 | | Operate | A value that specifies whether or not the data is updated. Data-Type: Bit, Flag Data-Range: 0 - 1 | | Scale | A value that specifies the scale of the Value property Data-Type: Nibble Data-Range: 0 - 1 | | Unsigned | A value that specifies if the Value property is a signed value or not. Data-Type: Bit Data-Range: 0 - 1 | | Value | A value that indicates the current compass heading. Data-Type: Word, Default Data-Range: 0 - 360 |
|
| Example: |
| | 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.
' 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
|
|
| 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 Module | Socket Wiring Diagram |
|---|

|  | | Pin | Name | Description | I/O Bit | IOGroup |
|---|
| 1 | 2 | 3 |
|---|
| P1 | SCLK | Serial Clock | Bit-2 | 10 | 18 | 26 | | P2 | SDO | Serial Data Output | Bit-1 | 9 | 17 | 25 | | P3 | SDI | Serial Data Input | | | | | | P4 | SS | Slave Select | Bit-0 | 8 | 16 | 24 | | P5 | PC | Poll / Continuous | Bit-0 | 8 | 16 | 24 | | P6 | CAL | Calibrate | | | | | | P7 | RES | Resolution | | | | | | P8 | M/S | Master / Slave | | | | | | P9 | BCD/Bin | BCD / Binary | | | | | | P10 | Y Flip | Flip Y-axis | | | | | | P11 | X Flip | Flip X-axis | | | | | | P12 | CI | Calibrate indicator | | | | | | P13 | EOC | End of Conversion | Bit-3 | 11 | 19 | 27 | | P14 | RAW | Raw data mode | | | | | | P15 | VCC | +5 Volt power | +5 Volts | | | | | P16 | GND | Power Return | Gnd | | | | | P17 | RESET | Reset | Bit-4 | 12 | 20 | 28 |
|
|
| See Also: |
| | oCompassDN - An Object that reads a Dinsmore 1490 Compass. |