Title: Computer Engineering Activities Interfacing Music Box Project ACSE 2004
1Computer Engineering ActivitiesInterfacingMusic
Box ProjectACSE 2004
2Computer Engineering Units
- Grade 10/11/12
- 1. Hardware
- 2. Networking
- 3. Integrated Circuits
- 4. Programming
- 5. Interfaces
3Interfacing Activities
- Grade 10
- One bit
- Three LEDs
- LED simulators
- ASCII
- Binary counting
- Light patterns
- Intersections
- AC ???
- Grade 11
- One bit
- One byte
- DC motor
- Bi-directional
- LED traffic light
- LED intersection
- Demultiplexer
- GUIs
- Mouse control
- AC ??
4Interfacing Activities
- Grade 12
- One byte
- LED intersection
- Stop Lights AC?
- Vehicles
- Security systems
- Drag strips
- Music Box
- Latches
- Marquees
- GUIs/Mouse Control
5Introduction to Traffic Lights
6Traffic Lights
7Traffic Lights
8Introduction to Motors
9Motors
10Introduction to Music
11Music Box
Note indicator Light
Note push button
12Music Pipe Organ
13Breadboard Connections
Connected
High Fives
Divider
Low Fives
Connected
14Music Box Software
Turing
- parallelput(number) - reads 8 pins
- put parallelget - reads 5 pins
- mousewhere(x,y,click)
- play(CDEFG)
- drawline(x1,y1,x2,y2,red)
- FREE!!!
15Interfacing System Unit 5
Computer Interface Peripheral
- Wires
- ICs
- Resistors
- Capacitors
- Transistors
- LED's
- Motors
- Lights
- Robots
- Music Box
- Joysticks
Wires
Wires
16Music Box Hardware
- Five male pins
- One D sub connector
- Cable 1 D sub to Breadboard
- Four N.O. pushbuttons
- Four Resistors (Brown/Black/Orange)
- One Breadboard
- Extra wire
- Enhancement hardware ????
17Music Box Hardware - Resistor(Four Required)
1 0 X 103
Brown Black
Orange Gold
Tolerance -5
18Resistor Chart
19Music Box Hardware Cable D sub to Breadboard
Male Pin
Insulated Wire
Small Crimp Tab
Stripped Wire
Large Crimp Tab
203 Pair Cable
White/Green Green/ White Orange/
White White/Orange Blue/ White White/ Blue
21Cable with Male Pins
22Music Box HardwareNormally Open Switch
Schematic
Physical
1
1
2
2
23Inputting Data
24Music Box Hardware Parallelport
Input I0 I3
Output D0 D7
13 12 11 10 9 8 7 6
5 4 3 2 1
25 24 23 22 21 20 19 18 17
16 15 14
Input I4
Grounds 18 - 25
View from back of Computer
25 D Sub Connector /Harness
26D Sub Connector Colour Code
27 D Sub Connector
Pin 10
Pin 2
D sub Connector
Pin 18
28D Sub Connector
Pin 2
Check
Bottom, 2 Down
29D Sub Connector
Check
Pin 2, Bottom, 2 Down
Pin 18, Top, 5 Down
Pin 10, Bottom, 10 Down
Pin 11
Pin 12
Pin 13
Total of six wires from D sub connector
30Breadboard
Switches Span Divider
31Breadboard with Resistors
Resistors to Top Rail
Brown/Black/Orange
Align
32D Sub to Breadboard Cable
To Pin 2 White/Green
Four Wires
To Pin18 White/Blue
Switch to Ground
33D Sub to Breadboard Cable
Pin 10 Green/ White
Pin 11 Orange/ White
Pin 12 White/Orange
Pin 13 Blue/ White
Pin 2 White/Green
Pin18 White/Blue
34The hardware is complete. Now to the software
35Music Box Software Assignment 1
Write a program that will continuously scan for
input values from the MUSIC BOX.
36Music Box SoftwareAssignment 1
parallelput(1) loop Start of infinite loop.
put parallelget Returns input pin
values. end loop End of loop.
37Music Box Note Matrix
Remember these Numbers
38Music Box Software Assignment 2
Write a program that will play the notes CDEG
each as quarter notes.
39Music Box Software Assignment 2
parallelput(1) var value int loop value
parallelget if value ______ then play
(C) elsif value _____ then play
(D) Etc Save as MusicBox2
40Music Box Software Assignment 3
Write a program that will play the notes CDEG
each as quarter notes and at the same time
display a GUI representing the played notes.
41Adding Graphics Screen
(640,400)
(0,0)
42Music Box Software Assignment 3 A GUI part 1
- locatexy (300, 300)
- put "MUSIC BOX PLAYER"
- locatexy (200, 140)
- put "C D E G"
- drawing 4 circles with perimeter black
- drawoval (200, 200, 40, 40, black)
- drawoval (300, 200, 40, 40, black)
- drawoval (400, 200, 40, 40, black)
- drawoval (500, 200, 40, 40, black)
43Music Box Software Assignment 3 A GUI part 2
- filling 4 circles with white
- drawfilloval (200, 200, 40, 40, white, black)
- drawfilloval (300, 200, 40, 40, white, black)
- drawfilloval (400, 200, 40, 40, white, black)
- drawfilloval (500, 200, 40, 40, white, black)
44Music Box Software Assignment 3 A GUI part 3
- parallelput(1)
- var value int
- loop
- value parallelget
- if value ______ then
- fills C GUI with red
- drawfilloval (200, 200, 40, 40, red, black)
- plays C for a quarter note
- play C
- sets C GUI back to white
- drawfilloval (200, 200, 40, 40, white, black)
45Music Box Software Assignment 3 A GUI part 4
- elsif value _____ then
- fills D GUI with red
- drawfilloval (300, 200, 40, 40, red, black)
- play D
- sets D GUI back to white
- drawfilloval (300, 200, 40, 40, white, black)
- Similarly for notes E and G
Save as MusicBox3
46Music Box Tune
Mary had a little lamb E D C D E E E
rest Little lamb D D D rest Little lamb E G
G rest Mary had a little lamb E D C D E
E E rest Whose fleece was white as snow E
D D E D C
Save as MusicBox4
47Music Theory
- play (8CDEFGABgtC) plays one octave of 8th
notes from middle C - play(ltBAGFEDC) plays scale in reverse in 8th
notes if it follows previous line - play (gt4CDEFGAB) plays one octave of quarter
notes one octave up from middle C - play ("gt6CpCpC-") plays one octave up from
middle C, a C 16th note, a rest, C sharp, a rest,
and a C flat - play(1C2C4C6C) plays whole, half, quarter,
and 16th C note
48Music Box Software Assignment 4
- Write a program that will
- play a tune
- display a GUI of the notes being played
- change the colour of the note name.
Save as MusicBox5
49Music Box Software Assignment 5
Write a program that will automatically play
Mary Had a Little Lamb.
Save as MusicBox6
50Additional Music Box Software
- Additions
- Add an LED above each key on the keyboard
- Add additional keys to the keyboard
- Store a tune
- Test a users ability to replay the tune
51More Hands-On Activities
- Keyboard
- Intersection
- Robot
- Worlds Largest Joystick
52Addresses
smythel_at_mnsi.net www.classictechnology.ca www.ho
ltsoft.com