28123 Parallax Inc, 28123 Datasheet - Page 252

TEXT WHAT'S A MICROCONTROLLER

28123

Manufacturer Part Number
28123
Description
TEXT WHAT'S A MICROCONTROLLER
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28123

Style
Book
Title
What's a Microcontroller?
Contents
Whats a Microcontroller? Text
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
Lead Free Status / RoHS Status
Not applicable / Not applicable
The remainder of this example program works the same way that it did in the previous
example program:
Your Turn – Playing a Tune with More than One Octave
MusicWithMoreFeatures.bs2 made use of rests, but it stayed in one octave. The tune
“Take Me Out to the Ball Game” shown below plays most of its notes in the 6
There are two notes in the 7
Notes
Octaves
Durations
Dots
BeatsPerMin
MusicWithMoreFeaturesYourTurn.bs2.
LOOP
END
Save the example program under the name
Modify the program by replacing the four data directives and one constant
declaration with these:
Run the program and verify that it sounds right.
Integer math The BASIC Stamp does not automatically process a number like 1.5. When
performing math, it only works with integers: …, -5, -4, -3, -2, -1, 0, 1, 2, 3, … The best
solution for multiplying by 1.5 is to multiply by 3/2. First, multiply by 3, and then divide by 2.
There are many ways to program the BASIC Stamp to handle fractional values. You can
program the BASIC Stamp to use integers to figure out the fractional portion of a number.
This is introduced in the Basic Analog and Digital Student Guide. There are also two
operators that make fractional values easier to work with, and they are:
are explained in detail in the Applied Sensors Student Guide and in the BASIC Stamp
Manual.
FREQOUT 9, noteDuration, noteFreq
index = index + 1
DATA
DATA
DATA
DATA
CON
th
octave, and they make a big difference to the way it sounds.
"C","C","A","G","E","G","D","P","C","C","A",
"G","E","G","Q"
240
6,
6,
2,
4,
0,
0,
7,
6,
4,
4,
0,
0,
6,
6
4,
2
0,
1
6,
4,
0,
6,
4,
0,
6,
2,
1,
6,
2,
0,
6,
4,
0,
**
and
6,
2,
0,
*/
th
7,
4,
0,
. These
octave.
6,
4,
0,

Related parts for 28123