28123 Parallax Inc, 28123 Datasheet - Page 238

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
DEBUG "Ti...", CR:
DEBUG "Do...", CR:
END
Your Turn – Sharp/Flat Notes
Storing and Retrieving Sequences of Musical Notes
A good way of saving musical notes is to store them using the BASIC Stamp module’s
EEPROM. Although you could use many
use the
Here is an example of how to use the
correspond to musical notes.
You can use the
address
letter ‘G’ at
into a byte variable called
You can also store lists of numbers using the
values that the BASIC Stamp uses for musical notes need to be stored in word variables
because they are usually greater than 255. Here is how to do that with a
DATA
Notes + 0
{Symbol} DATA {Word} DataItem {, {Word} DataItem, … }
Notes DATA "C","C","G","G","A","A","G"
READ Notes + 6, noteLetter
Frequencies DATA Word 2093, Word 2093, Word 3136, Word 3136,
Use the frequencies shown in Figure 8-3 to add the five sharp/flat notes to
DoReMiFaSolLaTiDo.bs2
Modify your program so that it plays the next octave up. Hint: Save yourself
some typing and just use the
example,
octave.
Notes + 2
directive. This is the syntax for the
READ
FREQOUT 9, 500, 1175 * 2
, and a second letter ‘C’ is located at
FREQOUT 9,500,1976
FREQOUT 9,500,2093
command to access these characters. The letter ‘C’ is located at
, and so on. For example, if you want to load the last letter ‘G’
noteLetter
Word 3520, Word 3520, Word 3136
, use the command:
* 2
WRITE
DATA
operation after each
DATA
' B6
' C7
DATA
commands to do this, a better way is to
directive to store the characters that
will give you D7, the D note in the 7
directive. Frequency and duration
directive:
Notes + 1
Freq1
. Then, there’s a
DATA
argument. For
directive.
th

Related parts for 28123