28123 Parallax Inc, 28123 Datasheet - Page 251

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
Depending on the octave, we want to divide
that the goal is really to divide by 2
takes the value of
that value from 8. If
If
Now,
to a power in PBASIC? One answer is to use the
DCD 2
dividing by 1, 2, 4, or 8, which divides
result is that
the Your Turn section to take a closer look at how this works.
The first two lines of code for determining the note duration are about the same as the
code from the previous example program. Now, however, any note could be dotted,
which means the duration might have to be multiplied by 1.5. A
to access values stored in
used to multiply by 3 and divide by 2 whenever the value of the
noteOctave
noteOctave
is 4, and
How am I supposed to know to use the DCD operator? Keep learning and practicing.
Every time you see a new command, operator, or any other keyword used in an example,
look it up in the BASIC Stamp manual. Read about it, and try using it in a program of your
own design. Get in the habit of periodically reading the BASIC Stamp Manual and trying the
short example programs. That’s the best way to get familiar with the various commands and
operators and how they work. By doing these things, you will develop a habit of always
adding to the list of programming tools you can use to solve problems.
noteOctave = 8 - noteOctave
noteFreq = noteFreq / (DCD noteOctave)
READ Durations + index, noteDuration
noteDuration = WholeNote / noteDuration
READ Dots + index, noteDot
IF noteDot = 1 THEN noteDuration = noteDuration * 3 / 2
noteFreq
was 6, now it’s 2, and if
DCD 3
noteOctave
is a value that can be used as an exponent of 2, but how do you raise 2
noteOctave
is set to the correct octave. You will use the Debug Terminal in
is 8. Dividing
EEPROM
, which could be a value between 5 and 8, and subtracts
by the
was 8, now it’s 0. If
0
= 1, 2
noteOctave
noteFreq
noteFreq
Dots DATA
1
noteFreq
= 2, 2
DCD
2
by
down by the correct value. The end
= 4, or 2
was 5, now it’s 3.
directive. An
by either 1, 2, 4, or 8. That means
operator.
DCD noteOctave
noteOctave
3
= 8. The statement below
noteDot
DCD 0
READ
IF…THEN
was 7, now it’s 1.
command is used
is 1,
variable is 1.
means you are
statement is
DCD 1
is 2,

Related parts for 28123