Description: |
| | The oOrbitSwitch8 Object is an I/O Function Object that reads a group of 8 switch inputs arranged in a circular fashion and calculates a value based on which side of the circle the switches are closed. |
| | The following table lists the size and availability of the oOrbitSwitch8 Object.
| | Object | Size | Description | A1 | A2 | B1 | B2 | C1 |
 | oOrbitSwitch8 | 4 Bytes | Reads a circular array of 8 switches. | x | x |
|
Operation: |
| | The oOrbitSwitch4 Object uses the 8 I/O lines specified by the IOGroup property to read a group of 8 switches arranged like the points of a compass plus the in-between points. Based on which switch is closed, a Heading value is calculated that indicates the general direction of the closed switch. In addition, if any two adjacent switches are pressed at the same time, the Heading value will indicate the direction of a point between the two switches. The Value that is calculated for the Heading is based on URCP Heading values. When any one of the 8 switches or two adjacent switches are closed, the Pressed property will be set to 1 and when all 8 switches are not closed, the Pressed property is cleared to 0. |
Properties: |
| The following table lists the properties of the oOrbitSwitch8 Object:
Property | Description |
| Heading |
| A value that indicates the heading in the direction of the bumper switch that has been pressed. |
 | Object Class: | oHeading | | Value Range: | -128 to +127 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| I/O Inputs | Bumpers | Heading | Pressed | 3 or 4 adjacent switches pressed |  URCP Heading
|
| I/O Inputs | Bumpers |
| 00000001 | -------x | 0 | 1 | 10010001 | x-----xx |
| 00010001 | ------xx | 16 | 1 | 10010011 | x----xxx |
| 00010000 | ------x- | 32 | 1 | 00010011 | -----xxx |
| 00010010 | -----xx- | 48 | 1 | 00110011 | ----xxxx |
| 00000010 | -----x-- | 64 | 1 | 00110010 | ----xxx- |
| 00100010 | ----xx-- | 80 | 1 | 00110110 | ---xxxx- |
| 00100000 | ----x--- | 96 | 1 | 00100110 | ---xxx-- |
| 00100100 | ---xx--- | 112 | 1 | 01100110 | --xxxx-- |
| 00000100 | ---x---- | -128 | 1 | 01100100 | --xxx--- |
| 01000100 | --xx---- | -112 | 1 | 01101100 | -xxxx--- |
| 01000000 | --x----- | -96 | 1 | 01001100 | -xxx---- |
| 01001000 | -xx----- | -80 | 1 | 11001100 | xxxx---- |
| 00001000 | -x------ | -64 | 1 | 11001000 | xxx----- |
| 10001000 | xx------ | -48 | 1 | 11001001 | xxx----x |
| 10000000 | x------- | -32 | 1 | 10001001 | xx-----x |
| 10000001 | x------x | -16 | 1 | 10011001 | xx----xx |
| Other | | Unchanged | 0 | |
|
|
| Pressed |
| A value that indicates if any of the switches are pressed. |
 | Object Class: | oLogic | | Value Range: | 0 - 1 |
| Data Type: | Numeric | | Default Value: | 0 |
|
|
| IOGroup |
| A value that specifies which group of 8 I/O lines is connected to the switches. |
 | 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 switches are being read. |
 | Object Class: | oOperate | | Value Range: | 0 - 1 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| Operate | Constant | Description |
| 0 | cvOff | The I/O lines are not read. |
| 1 | cvOn | The I/O lines are 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 |
|
|
|
Example:
|
| The following examples use the oOrbitSwitch8 Object.
| Visual Basic Syntax | C and Java Syntax |
' This program reads a 8 switch
' bumper, displays the URCP
' heading value on I/O lines
' 24 - 31 and the Received
' property on I/O line 7.
Dim A As New oOrbitSwitch8
Dim B As New oDIO8
Dim C As New oDIO1
Sub Main()
ooPIC.PullUp = 1
A.IOGroup = 1
A.Operate = cvTrue
B.IOGroup = 3
B.Direction = cvOutput
C.IOLine = 7
C.Direction = cvOutput
Do
B.Value = A.Value
C.Value = A.Pressed
Loop
End Sub | // This program reads a 8 switch
// bumper, displays the URCP
// heading value on I/O lines
// 24 - 31 and the Received
// property on I/O line 7.
oOrbitSwitch8 A = New oOrbitSwitch8;
oDIO8 B = New oDIO8;
oDIO1 C = New oDIO1;
Void Main(Void){
ooPIC.PullUp = 1;
A.IOGroup = 1;
A.Operate = cvTrue;
B.IOGroup = 3;
B.Direction = cvOutput;
C.IOLine = 7;
C.Direction = cvOutput;
Do{
B.Value = A.Value;
C.Value = A.Pressed;
} While (1);
} |
| Basic Syntax | |
' This program reads a 8 switch
' bumper, displays the URCP
' heading value on I/O lines
' 24 - 31 and the Received
' property on I/O line 7.
A Var oOrbitSwitch8(1,cvOn)
B Var oDIO8(3,cvOutput)
C Var oDIO1(7,cvOutput)
ooPIC.PullUp = 1
Do
B.Value = A.Value
C.Value = A.Pressed
Loop | |
|
Connections: |
| See the oBumper8 Object for connection examples. |
Related Items:
|
| | The following table lists objects that use the oOrbitSwitch8 Object.
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oBumper8 | Reads an 8-contact bumper. | x | x |
|
| | The following table lists objects with related functions
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oOrbitSwitch4 | Reads a circular array of 4 switches. | x | x |
|
Version History and Bug List: |
| | Firmware Ver B2: Introduced. Bugs: No known bugs. |