27220 Parallax Inc, 27220 Datasheet - Page 226
27220
Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet
1.27220.pdf
(230 pages)
Specifications of 27220
Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
- Current page: 226 of 230
- Download datasheet (3Mb)
What happened to the -1? It was applied to the divisor and that value is added to
the intermediate result.
The key to mastering modulus is remembering that it will return a value between
zero and the divisor used. Let’s say you want to generate a pseudo-random number
between 20 and 50 when a button is pressed. Here’s how:
Do you see how this works? The span between 20 and 50 is 30, so we use 31 as the
divisor for modulus.
Use Conditional Compilation
BASIC Stamp microcontrollers have been around a few years, and as would be
expected, new models are faster and have more features than the older ones. The
BASIC Stamp IDE allows for conditional compilation so that you can construct a code
that will run on any BS2 module. The most common problem for BASIC Stamp
programmers when moving from one module to another is with SERIN and SEROUT.
By using conditional compilation to define baudmode constants these problems are
eliminated. The code fragment below is abbreviated from the definitions provided in
my standard programming template (Template.BS2).
Main:
#SELECT $STAMP
#ENDSELECT
DO
LOOP UNTIL (StartBtn = Pressed)
selection = randVal // 31 + 20
#CASE BS2, BS2E, BS2PE
#CASE BS2SX, BS2P
#CASE BS2PX
RANDOM randVal
T2400
T9600
T19K2
T38K4
T2400
T9600
T19K2
T38K4
T2400
T9600
T19K2
T38K4
CON
CON
CON
CON
CON
CON
CON
CON
CON
CON
CON
CON
396
84
32
6
1021
240
110
45
1646
396
188
84
Related parts for 27220
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: