28123 Parallax Inc, 28123 Datasheet - Page 244

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
How NotesAndDurations.bs2 Works
The
directives combined with the
used by the program.
The declarations for the five variables used in the program are shown below. Even
though a
variable (
Durations
select a particular value. The
READ
a frequency value. This value is stored in the
FREQOUT
command to receive a value from the
Duration
The main loop keeps executing until the letter ‘Q’ is read from the
A
variable. The
of the
detected, a 3 if “C” is detected, and so on. This
command to figure out what the value of the
1,
noteFreq
READ
noteFreq
Notes
command.
offset
command gets a character from the
index
offset
noteLetter
noteFreq
noteDuration
DO UNTIL noteLetter = "Q"
command’s
index
FOR…NEXT
used in the
is 2093, and so on.
READ Notes + index, noteLetter
LOOKDOWN noteLetter, [
LOOKUP offset,
. The
and
noteLetter
will be 1865, if
variable. Remember that
Durations DATA
) that keeps track of which
LOOKUP
offset
loop is no longer used to access the data, there still has to be a
FREQOUT
Freq1
and
VAR
VAR
VAR
VAR
VAR
variable is used in the
variable is then used in a
argument. The
LOOKDOWN
WholeNote
noteLetter
command.
Byte
Nib
Byte
Word
Word
offset
directives were discussed before the program. These
[ 1760, 1865, 1976, 2093, 2217,
Durations DATA
offset
commands are used to convert this character into
"A",
"D",
"G",
is 2,
constant are used to store all the musical data
Notes DATA
variable stores a character accessed by the
noteFreq
noteDuration
DATA
noteFreq
stores a 1 if “b” is detected, a 2 if “B” is
"b",
"e",
"a",
offset
LOOKDOWN
noteFreq
LOOKDOWN
entry is being read in
, and stores it in the
variable should be. If
. It is also used to calculate the
"B",
"E",
"P",
value is then used in a
will be 1976, if offset is 3,
variable is used in a
and
variable and used as the
command to set the value
"C",
"F",
"Q" ], offset
Notes DATA
LOOKUP
"d",
"g",
commands to
noteLetter
Notes
.
offset
LOOKUP
READ
and
is

Related parts for 28123