28122 Parallax Inc, 28122 Datasheet - Page 263

KIT WHAT'S A MICRO:PARTS ONLY

28122

Manufacturer Part Number
28122
Description
KIT WHAT'S A MICRO:PARTS ONLY
Manufacturer
Parallax Inc
Datasheet

Specifications of 28122

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
For Use With/related Products
Board of Education Full Kit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
' -----[ Subroutine - Check For '.' Indicating 1.5 Duration ]-------------
' -----[ Subroutine - Find Comma and Play Note/Duration ]-----------------
How MicroMusicWithRtttl.bs2 Works
This example program is fun to use, and it shows the kind of code you will be able to
write with some practice. However, it was included in this text more for fun than for the
coding concepts it employs.
If you examine the code briefly, you might notice that you have already used all of the
commands and operators in the program. Here is a list of the elements in this application
example that should, by now, be familiar:
CheckForDot:
PlayNote:
ENDIF
RETURN
READ RTTTL_File + counter, char
SELECT char
ENDSELECT
RETURN
READ RTTTL_File + counter, char
SELECT char
ENDSELECT
RETURN
CASE "."
CASE ","
Comments to help explain your code
duration = duration * 3 / 2
counter = counter + 1
counter = counter + 1
READ Octave8 + (index * 2), Word noteFreq
noteOctave = 8 - noteOctave
noteFreq = noteFreq / (DCD noteOctave)
IF noteFreq = 0 THEN
ELSE
ENDIF
FREQOUT SpeakerPin, duration, noteFreq
PAUSE duration
' Check for dot indicating
' multiply duration by 3/2.
' If dot found, multiply by
' 3/2 and increment counter,
' else, do nothing and
' return.
' Find last comma in the
' current note entry.
' fetch the note frequency
' from data, and play it, or
' pause if frequency = 0.
Then,

Related parts for 28122