28123 Parallax Inc, 28123 Datasheet - Page 246

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
Adding Musical Features
The example program you just finished introduced notes, durations, and rests. It also
used the duration of a whole note to determine tempo. Cell phones that play music to let
you know that somebody is calling have three features that were not supported by the
previous example program:
The term “dotted” refers to a dot used in sheet music to indicate that a note should be
played 1 ½ times as long as its normal duration. For example, a dotted quarter note
should last for the duration of a quarter note, plus an eighth note. A dotted half note lasts
for a half plus a quarter note’s duration. You can add a data table that stores whether or
not a note is dotted. In this example, a zero means there is no dot while a 1 means there
is a dot:
Dots
Cell phones typically take the tempo for a song in beats per minute. This is the same as
saying quarter notes per minute.
Figure 8-4 is a repeat of
piano keyboard. These are the two octaves that sound the clearest when played by the
piezospeaker. Here is an example of a
section to play notes from more than one octave using the
Notes
Durations DATA
WholeNote CON
They play “dotted” notes.
They determine the whole note duration from a value called tempo.
They play notes from more than one octave.
BeatsPerMin
Save your modified program Beethoven’sFifth.bs2.
Replace the
constant declaration with the code above.
Run the program. Does it sound familiar?
DATA
DATA "G","G","G","e","P","F","F","F","D","Q"
Notes
Figure 8-3
CON
2000
and
200
8,
0,
0,
from page 228. It shows the 6
Durations DATA
0,
0,
8,
DATA
0,
0,
8,
directive you will use in the Your Turn
0,
1,
2,
0,
0
directives and the
8,
Notes DATA
0,
8,
1,
th
and 7
8,
0,
directive.
th
octaves on the
0,
8,
WholeNote
0,
2
0,

Related parts for 28123