27403 Parallax Inc, 27403 Datasheet - Page 133
27403
Manufacturer Part Number
27403
Description
GUIDE APP ROBOTCS W/SUMOBOT V1.0
Manufacturer
Parallax Inc
Datasheet
1.27404.pdf
(266 pages)
Specifications of 27403
Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
SumoBot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
- Current page: 133 of 266
- Download datasheet (6Mb)
ACTIVITY #7: ORGANIZING SENSORS WITH FLAG BITS
Storing each sensor value as an individual bit is great for decision making, especially if
you want to isolate only one or two variables. In other cases, it's better to have all your
bits in a larger variable. It makes it easier for your program to analyze patterns in the
sensor flags. With PBASIC, you can have it both ways. This activity demonstrates how
to declare a sensors variable, and then declare individual flag bits within that variable.
Bit Declarations inside a Byte
By storing all your flag bits in a larger variable, they are still accessible as individual
values, but they are also accessible as a group for pattern analysis. It doesn't make
programming any more difficult. In fact, with PBASIC all you have to do is declare a
byte variable, and then declare the names of each individual bit in the byte.
For example, here are the 7 bit-variable declarations from TestAllSensorsYourTurn.bs2.
To arrange these in a byte, simply declare the byte variable, and then declare each bit as a
member of the byte variable. For example, if the byte is named
sensors.BIT0, irRF
variable declarations within a single
√
√
√
Repeat by using this feature to change
Some of the comments may now be out of alignment. Go through the program
and insert spaces to line the side comments back up to column 46.
Save your modified program; you will need it in the next couple activities.
irLS
irLF
irRF
irRS
qtiLF
qtiRF
pushbutton
sensors
pushbutton
qtiLF
qtiRF
can be
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
sensors.BIT1
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Byte
sensors.BIT6
sensors.BIT5
sensors.BIT4
sensors
byte variable:
qtiStateLeft
, and so on. Here is the entire series of
' Sensor flags byte
' Stores pushbutton state
' Stores snapshot of QtiSigLeft
' Stores snapshot of QtiSigRight
' State of Left Side IR
' State of Left Front IR
' State of Right Front IR
' State of Right Side IR
' Stores snapshot of QtiSigLeft
' Stores snapshot of QtiSigRight
' Stores pushbutton state
to
sensors, irRS
qtiLF
.
can be
Related parts for 27403
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
BOOK UNDERSTANDING SIGNALS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
COMPETITION RING FOR SUMOBOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
TEXT INFRARED REMOTE FOR BOE-BOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BOARD EXPERIMENT+LCD NX-1000
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
CONTROLLER 16SERVO MOTOR CONTROL
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BASIC STAMP LOGIC ANALYZER
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
IC MCU 2K FLASH 50MHZ SO-18
Manufacturer:
Parallax Inc
Datasheet: