| Description: |
| |
A Hardware Object that reads a group of 8 bumper switch inputs and returns a URCP Heading value indicating the direction of the impact. |
| Operation: |
| |
The oBumper8 Object uses the 8 I/O lines specified by the IOGroup property to read a group of 8 bumper switches. It converts the data to a URCP Heading value indicating the direction of the impact which is then stored in the Value property. If any two or four adjacent bumper switches are pressed at the same time, the Value property is adjusted to a URCP Heading indicating that the impart was located between the two center bumper switches and if any three adjacent bumper switches are pressed at the same time, the Value property is adjusted to a URCP Heading indicating that the impact was located at the position of the center switch. When any one of the 8 bumper switches or two, three or four adjacent bumper switches are pressed, the Received property will be set to 1 and when all 8 bumper switches are not are pressed or two or more non-adjacent switches are pressed, the Received property is cleared to 0. |
| Storage size & Availability: |
| |
The following table lists the size and availability of the oBumper8 Object:
| Object | Size | Version |
 |
oBumper8 |
4 Bytes |
B.2.0 |
|
| Properties: |
| |
The following table lists the Properties of the oBumper8 Object:
| Property |
Description |
| Address |
Returns a pointer to the address of the oBumper8 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 |
| Operate |
A value that specifies whether or not the data is updated. Data-Type: Bit, Flag Data-Range: 0 - 1 |
| Unsigned |
A value that specifies if the Value property is signed or unsigned. Data-Type: Bit Data-Range: 0 - 1 |
| Value |
A value that indicates the current URCP Heading position that the impact was detected at. Data-Type: URCP Heading, Byte, Default Data-Range: when signed: -128 to +127, when unsigned: 0 - 255
| I/O Inputs | Bumpers | Position | Signed Value | Unsigned Value | Received | 3 or 4 adjacent switches pressed |
| I/O Inputs | Bumpers |
| 00000001 |
-------x |
Front |
0 |
0 |
1 |
10010001 |
x-----xx |
| 00010001 |
------xx |
|
16 |
16 |
1 |
10010011 |
x----xxx |
| 00010000 |
------x- |
Front-Left |
32 |
32 |
1 |
00010011 |
-----xxx |
| 00010010 |
-----xx- |
|
48 |
48 |
1 |
00110011 |
----xxxx |
| 00000010 |
-----x-- |
Left |
64 |
64 |
1 |
00110010 |
----xxx- |
| 00100010 |
----xx-- |
|
80 |
80 |
1 |
00110110 |
---xxxx- |
| 00100000 |
----x--- |
Back-Left |
96 |
96 |
1 |
00100110 |
---xxx-- |
| 00100100 |
---xx--- |
|
112 |
112 |
1 |
01100110 |
--xxxx-- |
| 00000100 |
---x---- |
Back |
-128 |
128 |
1 |
01100100 |
--xxx--- |
| 01000100 |
--xx---- |
|
-112 |
114 |
1 |
01101100 |
-xxxx--- |
| 01000000 |
--x----- |
Back-Right |
-96 |
160 |
1 |
01001100 |
-xxx---- |
| 01001000 |
-xx----- |
|
-80 |
176 |
1 |
11001100 |
xxxx---- |
| 00001000 |
-x------ |
Right |
-64 |
192 |
1 |
11001000 |
xxx----- |
| 10001000 |
xx------ |
|
-48 |
208 |
1 |
11001001 |
xxx----x |
| 10000000 |
x------- |
Front-Right |
-32 |
224 |
1 |
10001001 |
xx-----x |
| 10000001 |
x------x |
|
-16 |
240 |
1 |
10011001 |
xx----xx |
| Other |
|
Unchanged |
0 |
|
|
|
| Example: |
| |
In the following example, the oBumper8 Object is used.
' 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 oBumper8
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.Received
Loop
end sub
|
|
| Connections |
| |
The oBumper8 uses 8 I/O lines. These 8 I/O lines must be 8 contiguous I/O lines starting with I/O line 8, 16 or 24. The inputs are active low and each of the 8 I/O lines will require a pull up resister. If the I/O lines starting with I/O line 8 are selected, the internal pull up resisters can be used by setting the OOPic.PullUp property to 1. The first set of 4 I/O lines of the 8 are used for the 4 four switches; Front, Left, Back and Right. The second set of 4 I/O lines of the 8 are used for the 4 four switches; Front-Left, Back-Left, Back-Right & Front-Right.
| Switch Position | Typical wiring for each switch |
 |
 |
| IOGroup: | 1 | 2 | 3 | Switch Location |
| I/O 0: |
8 |
16 |
24 |
Front |
| I/O 1: |
9 |
17 |
25 |
Left |
| I/O 2: |
10 |
18 |
26 |
Back |
| I/O 3: |
11 |
19 |
27 |
Right |
| I/O 4: |
12 |
20 |
28 |
Front-Left |
| I/O 5: |
13 |
21 |
29 |
Back-Left |
| I/O 6: |
14 |
22 |
30 |
Back-Right |
| I/O 7: |
15 |
23 |
31 |
Front-Right |
|
Caution: IOGroup 2 contains special purpose I/O such as Debugging, Serial Port & PWM. Do not use IOGroup 2 if these other functions are in use. |
| See Also: |
| |
oBumper4 - An Object that reads a 4 switch bumper. |