A Facilitated Learning Environment for Mentally Disabled Children

Similar documents
How to use the PSoC based 16C450 Replacement

8051 Single Board Monitor Programming. Minmon - Yeralan & Ahluwalia. PaulMon1 & PaulMon2 - Paul Stoffregen

MCS-51 Serial Port A T 8 9 C 5 2 1

CoE3DJ4 Digital Systems Design. Chapter 6: Interrupts

Department of EIE / Pondicherry Engineering College. Timer/Counters. Department of EIE / Pondicherry Engineering College 1

ELEG3923 Microprocessor Ch.9 Timer Programming

FACULTY OF ENGINEERING LAB SHEET

The 8000 Series Swiss Army Knife Manual

Chapter Family Microcontrollers Instruction Set

Interrupts. EE4380 Fall 2001 Class 9. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

Introduction To MCS-51

8051 Microcontroller Assembly Programming

Chapter 6 Interrupts. (I. Scott Mackenzie) By: Masud-ul-Hasan

2. Write an 8051 program to generate a square wave of 25 khz at pin P2.3 using XTAL = 12 MHz. Solution:

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT89S52

Lab-Report Microprocessors

Microcontroller Intel [Instruction Set]

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

Interrupt Programming: Interrupts vs. Polling Method:

MicroConverter Technical Note - uc007 User Download (ULOAD) Mode

8051 Microcontroller

Microcontroller and Embedded Systems:

CPEG300 Embedded System Design. Lecture 6 Interrupt System

Question Bank Microprocessor and Microcontroller

Embedded Controller Programming

Subroutines & Software Delay Routines


EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

MICROPROCESSORS AND MICROCONTROLLERS MATERIAL. Features of 8051:

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

Advantages of Using a Dallas Semiconductor DS1232 MicroMonitor

Chapter 09. Programming in Assembly

MODULE-1. Short Answer Questions

~: Simple Programs in 8051 assembly language :~

8051 Core Specification


8051 Timers and Serial Port

Mod-3: Interrupts,Timer operation,serial communication 1

UNIT THE 8051 INSTRUCTION SET AND PROGRAMMING

Vidyalankar T.E. Sem. V [ETRX] Microprocessors and Microcontrollers I Prelim Question Paper Solution

8051 Overview and Instruction Set

MultimediO User s Guide

8051 Microcontroller

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Programming Book Microcontroller Kit. Rev 3.0 January, Wichit Sirichote

MASSEY UNIVERSITY PALMERSTON NORTH CAMPUS

Arithmetic and Logic

8051 I/O and 8051 Interrupts

C H A P T E R 1 INTRODUCTION

EE6502- MICROPROCESSOR AND MICROCONTROLLER

Assembly Language programming (2)

8-Bit Microcontroller with 2K Bytes Flash AT89C2051. Features. Description. Pin Configuration

CPEG300 Embedded System Design. Lecture 8 Timer

80C451 operation of port 6

Hardware Setups for Communication with a DS1267

Assembly Language programming (3)

Digital Blocks Semiconductor IP

Principle and Interface Techniques of Microcontroller

INTERRUPTS PROGRAMMING

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

1. Pin diagram of 8051 and ports

TUTORIAL. Donal Heffernan University of Limerick May Tutorial D.Heffernan 2000,

Vector-based Pong on an Oscilloscope

Digital Blocks Semiconductor IP

Microcontroller. Instruction set of 8051

SN8F5000 Family Instruction Set

Department of Electronics and Instrumentation Engineering Question Bank

8051 Timers. Class 7 EE4380 Fall Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

8051 Serial Port. EE4380 Fall02 Class 10. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

Chapter 09. Programming in Assembly

D: arc SRC KUT51 KUT51LCD.LST KUT51LCD PAGE 1

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text

CPEG300 Embedded System Design. Lecture 3 Memory

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT- IV

8051 Microcontroller. Ali Ziya Alkar 1

Digital Blocks Semiconductor IP

8-Bit Microcontroller with 1K Bytes Flash. AT89C1051U Preliminary. Features. Description. Pin Configuration

ET355 Microprocessors Friday 6:00 pm 10:20 pm

UNIT-III ASSEMBLY LANGUAGE PROGRAMMING. The CPU can access data in various ways, which are called addressing modes

ELEG3923 Microprocessor Ch.4 I/O Ports

Module Contents of the Module Hours COs

INTEGRATED CIRCUITS. AN408 80C451 operation of port 6

Contents. Join the Technical Community Today!

8-bit Microcontroller with 2/4-Kbyte Flash AT89LP2052 AT89LP4052

MICROCONTROLLER BASED WATER LEVEL CONTROL SYSTEM

UNIT MICROCONTROLLER AND ITS PROGRAMMING

Microcontroller and Applications

CPEG300 Embedded System Design. Lecture Interface with Peripheral Devices

The Final Word on 8051 Microcontroller

CoE3DJ4 Digital Systems Design. Chapter 5: Serial Port Operation

Three criteria in Choosing a Microcontroller

User-defined Download Application Note

Introduction to uc & Embedded Systems

Fig 1. Block diagram of a microcomputer

Timers and interrupts

Principle and Interface Techniques of Microcontroller

Application Note AN21. Power-On-Reset (POR) Software Implementation. Low Voltage Reset (LVR) Watchdog Timer. Hardware Implementation

C51 Family. Architectural Overview of the C51 Family. Summary

8051 Microcontroller

Transcription:

A Facilitated Learning Environment for Mentally Disabled Children Jeanette Chan Massachusetts Institute of Technology 6.115 Microprocessor Lab May 14, 2002

Contents 1 Introduction 2 1.1 Overview... 2 1.2 BlockDiagram... 3 1.3 FlowChart... 4 2 Audio Subsystem 6 2.1 Function... 6 2.2 Implementation... 6 2.3 The8254... 6 2.4 Filtering... 8 2.4.1 Low-PassFilter... 9 2.4.2 Non-invertingAmplifier... 9 2.4.3 AudioAmplifier... 9 2.5 AudioCode... 10 3 Visual Subsystem 15 3.1 Function... 15 3.2 Implementation... 15 i

List of Figures 1.1 BlockDiagramoftheSystem... 3 1.2 FlowChartoftheSystem... 4 2.1 AudioImplementation... 7 2.2 FlowChartoftheSystem... 7 ii

List of Tables 2.1 TableofNoteConversions... 8 iii

Abstract This project was designed to involve both audio and visual aspects. It is a writing program that produces sounds and images correlating to the words entered by the user on the keyboard. The sounds and images are determined by the quantity of letters entered and what letters are actually entered. It is intended to help develop writing skills for children who may have mental retardation.

Chapter 1 Introduction The following project was not created simply as a final project but rather as an idea with a goal in mind. However, due to circumstances with time, it was never fully realized. The idea was a program where sounds and images were created based on the work a student typed. This idea was formulated from the goal of helping autistic children. Music therapy is the application of music to enhance personal lives by creating a positive change in the environment. In addition to this, it can be used as a tool to develop cognitive and learning areas and facilitate increased language comperhension. Studies have shown that music therapy is useful with autistic children ecause of this nonverbal, non theatening nature of it. Parallel music activities are designed to support the objectives of the child. The idea of the project is to create a writing program where musical and visual outputs are produced in response to a child producing a sentence. It was created in an attempt to produce some mechanism to encourge autistic childern to write. Many autistic children have little motivation to sit and write a simple story or anything at all. This program was designed to capture their attention and create a desire to write something. 1.1 Overview The design is simple. A child would type a sentence into the program. Upon hitting the period, most likely marking the end of the sentence, the program would generate sounds and images simultaneously on the screen. Each letter corresponds to a specific musical note. The rhythm is determined by 2

Jeanette Chan 3 KEYBOARD R31JP 8051 EXTENAL RAM AUDIO CIRCUIT RAM VISUAL CIRCUIT SPEAKER MONITOR Figure 1.1: Block Diagram of the System the number of notes per word. Orignally, the design was to play the notes in a chord but because of the many possible combination of letters (358,800 combinations), too many dissonant sounds would be produced. Only a maximum of four notes per word would actually be produced. At a young age, most words are at maximum five letters. The notes generated from the D above middle C and the F, two octaves higher. The visual images were displaying in sync with the audio output. Each note, at each rhythm was generated on the screen at the same rate that it was heard. That is, a faster note moved more quickly across the screen. Notes that were natural or sharp was also differentiated in appearance. However, due to the time constrictions, only one note was displayed at a given time. 1.2 Block Diagram Below is a block represenation of the implemenation of the project. The first block represents the input from the keyboard over the serial port. From there, the information is stored in the external RAM of the 8051, recording both the letter typed and the number of letters per word. After all the information is stored,

4 A Facilitated Learning Environment for Mentally Disabled Children Initialiaztion Recording Playback Exit Figure 1.2: Flow Chart of the System this information is sent to both the audio and visual blocks, whose main components are the 8254 and MC6847, respectively. From those subsystems, the audio signal is sent through a series of OP-AMPs which manipulate the signal. The signal is filtered to generate a better tone and through an amplifier to create a usable signal for the output speaker. The three main output signals from the MC6847 are sent through some logic circuits to produce the proper signal for the TV input. 1.3 Flow Chart The code flow in this system is an initialization block, a recording block, a series of loops and an exit block. In the initialization block, the peripherals utitlized are enabled and variables are set to some inital value. The interrupts (serial and external) along with the timers are also turned on, the components that run the whole system. The final function of this block is to store the first image, the staff lines, in the RAM and displayed this image on the screen. The recording block does as its name implies. It waits for a user input from the keyboard and displays it on the monitor. At the same time, the information needed to generate the audio and visual signals are stored in the 8051 s external RAM. The series of loops is the code that generates all the output signal from the stored information in the RAM. It runs through all the stored bytes until it reaches the end marker. From the stored bytes, it plays a tone and decides which type of note to play on a certain position on the staff. This series of loops is mainly implemented through an interrupt service program, or ISR. The final loop, the exit block, resets the screen and shuts off the music. It then

Jeanette Chan 5 loops back to the recording stage, at the initial value, overwriting old values. On the monitor, it sends a carriage return and a line feed to await the next sentence and the process is then repeated.

Chapter 2 Audio Subsystem 2.1 Function The audio subsystem works independently of the visual subsystem in generating tones to produce the music for the program. It generates the tone at the rhythm determined by the number of letters per word. The notes generated are a signal chord within a 16-note range. It responds automatically to changes in frequency so that the sound is continuous. 2.2 Implementation This part of the project was implemented mainly by use of the 8254, the programmable interval timer. From commands sent to it by the R31JP, signals of different frequencies are produced. The 8254 is selected by the LS138 in case multiple chips would be used simultanesouly, sharing the same lines. However, the 8254 can only generate square waves whose tonality is not as nice. It is then sent through a 4th-order filter to produce a sine wave. This sine wave, after processed by an audio amplifier, is heard through a set of speakers on the kit itself. This configuration is shown in Figure 3. 2.3 The 8254 The 8254 is a programmable interval timer that is capable of producing square waves at different frequencies and different duty cycles. It has three 16-bit counters which 6

Jeanette Chan 7 R31JP CLK LM138 8254 4th-order filter OP-AMP Audio Amp Speaker Figure 2.1: Audio Implementation D7-> D0 from R31JP NC 1 2 3 4 5 6 7 8 9 10 11 12 8254 24 23 22 21 20 19 18 17 16 15 14 13 #WR from R31JP #RD from R31JP A1 A0 NC Y0 from LM138 10MHz clk output Figure 2.2: Flow Chart of the System can be set in one of five different modes. It runs off of a 10MHz clock and as stated in the previous section, is selected by the LM138. For the purposes of this project, the 8254 was set to run in Mode 3, the square wave generator. The setup for the 8254 is shown in Figure 4. When the 8254 is initializes, the control word 76h is written to it. This selects counter/timer 1 to be in Mode 3, with two bytes being written to it, with the least significant byte written first. This allows the 8254 to generate tones from 152.6Hz to 10MHz. After the control word has been written, the output is set high. Once the full count has been written to the 8254, it remains high for half the count and then falls low for the remaining half. One way to stop the production of the square wave is to write another or the same control word to the 8254. For this lab, to stop the square wave, and hence the sound, the control word 76h will be rewritten to the 8254. Although the 8254 is capable of producing a wide range of frequencies, onyl frquencies in the range of 293.66Hz to 698.46Hz, which will produce a range of notes from

8 A Facilitated Learning Environment for Mentally Disabled Children Letter Note Frequency Count a, q D 293.66Hz 8504h b D# 311.13Hz 7D8Ch c, r E 329.63Hz 8504h d, s F 349.23Hz 8504h e F# 369.99Hz 7D8Ch f, t G 392.00Hz 8504h g G# 415.30Hz 7D8Ch h, u A 440.00Hz 8504h i A# 466.16Hz 7D8Ch j, v B 493.88Hz 8504h k, w C 532.25Hz 8504h l C# 554.36Hz 7D8Ch m, x D 587.32Hz 8504h n D# 622.26Hz 7D8Ch o, y E 659.26Hz 8504h p, z F 698.46Hz 8504h Table 2.1: Table of Note Conversions the D above middle C to the F, two octaves above. Below is a chart of the note to be produced, its frequencies and the count written to the 8254 to produce that note. However, the main problem with the 8254 is that although it is easily controlled (as opposed to sine wave generator chips), it only generates square waves whose tonality is much sharper and less pleasing to the human ear. This problem can be solved by sending the signal through filters to create a wave close to a sine wave. 2.4 Filtering Although digital signals are more easily manipulated, it has major constraints upon it since it can only obtain voltage levels of 0 Volts or 5 Volts. In order to make these signals more useful, analog circuits such as filters, are extremely useful. For this project, the square wave produced by the 8254 must be sent through three analog circuits before outputting it to the speaker.

Jeanette Chan 9 2.4.1 Low-Pass Filter Any oscillating wave would be usable to produce a sound through a speaker. However, a sine wave usually produces the best sounding output. Converting a square wave to a sine wave is usually accomplished with either a low pass or bandpass filter and a resistor network to achieve the desired impedance. A low pass filter will remove unwanted harmonics in the input signal. Using a higher order filter will produce a cleaner output signal. For the design of this low-pass filter, a 4th-order lows-pass filter with a cutoff frequency of 1Khz was used. Since the highest frequency that will be passed through this filter is 700Hz, 1 KHz was a safe cutoff level. [image] The values of the resistor and capacitors were chosen by the following equations. The vaules basically depended on the wanted gain and cutoff frequency. [equations] 2.4.2 Non-inverting Amplifier The result of this filter is a close approximation of the desired sine wave. But it is important not to overload the audio amplifier with a signal that is too large. In order to prevent this, the sine wave can be processed through a simple non-inverting amplifier with a varying gain. The gain of this op-amp will be reducing the value and varied by implementing the design with a potentiometer. [image] 2.4.3 Audio Amplifier Finally, appropiate circuitry must be added before the signal is fed to a speaker. The LM386 is an audio power amplifier and was configured to be an amplifier with gain of 20 and volume control. The LM386 is used to drive a speaker so that an analog signal can be listened to. The configuration is shown is Figure X. Lastly, this signal is sent to a set of speakers on thi kit. [image]

10 A Facilitated Learning Environment for Mentally Disabled Children 2.5 Audio Code To test the design of the audio part of the project, test code was written to play notes of different frequency. Later, this code will be used in programming the end system. This test program initializes the parts of the system, the 8254, the interrput service routines and whatever constants that are needed. It then waits for input from the user over the serial port and displays that character. It then stores the letters entered and the number of letters that word contains. To make the system somewhat more simple, only the first four letters of a word was recorded if the total number exceeds four. After the user completes the sentence (upon entering a period), the program jumps into playback made through use of the interrupt service routine. Interrupts were used to playback the recording since it uses timers and is capable of running routines at a desired rate. The notes were played back in a rhythm which was determined by the number of letters of the word entered. For example, a word of three letters would have its notes played back three times faster than a word with only one letter. The code below implements the above program. org 00h ljmp start org 0bh ljmp play_back org 100h start: lcall init lcall init_tone lcall init_sp lcall init_int type: lcall getchr lcall sndchr mov r2, a cjne a, #20h, per_check mov a, r0 mov dpl, r6 mov dph, r7 movx @dptr, a mov r0, #00h inc r4 mov a, r4 mov r6, a ljmp type

Jeanette Chan 11 per_check: cjne a, #2Eh, check_num mov a, r0 mov dpl, r6 mov dph, r7 movx @dptr, a mov r0, #00h mov dpl, r4 inc dptr mov a, #0FFh movx @dptr, a setb p3.2 mov r4, #0FFh mov r7, #0Fh play_loop: jb p3.3, play_loop mov dph, r7 mov dpl, r4 inc dptr movx a, @dptr mov r0, a inc r0 mov r4, dpl mov r7, dph lcall get_val mov r1, a mov r2, #01h mov a, r0 cjne a, #00h, do_rest ljmp exit_play do_rest: setb p3.3 jb p3.2, play_loop exit_play: lcall init mov a, #0Ah lcall sndchr mov a, #0Dh lcall sndchr mov dptr, #0FE03h mov a, #76h movx @dptr, a ljmp type check_num: cjne r0, #04h, note_conv ljmp type

12 A Facilitated Learning Environment for Mentally Disabled Children note_conv: mov dpl, r4 mov dph, r7 inc dptr movx @dptr, a mov r4, dpl inc r0 ljmp type play_back: jnb p3.2, exit_isr djnz r2, exit_isr djnz r0, play_note clr p3.3 ljmp exit_isr play_note: mov a, r1 mov r2, a mov dph, r7 mov dpl, r4 inc dptr movx a, @dptr mov r5, a lcall get_freq_low mov r4, dpl mov dptr, #0FE01h movx @dptr, a mov a, r5 lcall get_freq_high movx @dptr, a ljmp exit_isr exit_isr reti get_val: inc a movc a, @a+pc ret db 0h, 12h, 09h, 06h, 04h, 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h get_freq_low: inc a movc a, @a+pc ret db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;00-0F db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;10-1f db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;20-2f db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;30-3f

Jeanette Chan 13 db 0, 04h, 8Ch, 81h, 0DAh, 93h, 0A6h, 0Eh, 0C7h, 0CBh, 17h, 0A7h, 76h, 82h, 0C6h, 40h ;40 db 0EDh, 04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bh, 37h, 0, 0, 0, 0, 0 ;50 db 0, 85h, 7Dh, 76h, 6Fh, 69h, 63h, 5Eh, 58h, 53h, 4Fh, 4Ah, 46h, 42h, 3Eh, 3Bh ;60 db 37h, 85h, 76h, 6Fh, 63h, 58h, 4Fh, 4Ah, 42h, 3Bh, 37h, 0, 0, 0, 0, 0 ;70 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;80 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;90 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;A0 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;B0 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;C0 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;D0 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;E0 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;F0 init: mov r0, #00h mov r4, #00h mov r7, #10h mov r6, #00h clr p3.3 clr p3.2 ret init_tone:

14 A Facilitated Learning Environment for Mentally Disabled Children mov dptr, #0FE03h mov a, #76h movx @dptr, a ret init_sp: mov tcon, #01000000b mov th1, #0fdh mov scon, #01010000b ret init_int: mov tmod, #00100001b setb ea setb tr0 setb et0 ret getchr: jnb ri, getchr mov a, sbuf anl a, #7fh clr ri ret sndchr: clr scon.1 mov sbuf,a mov p1, a txloop: jnb scon.1, txloop ret

Chapter 3 Visual Subsystem 3.1 Function The function of the visual subsystem is to generate the images in sync with the audio subsystem. The visual subsystem is responsible for generation the proper image at the right location in the staff. It is also responsible for moving the images at the rate determined by the user input. It is interfaced to a simple monitor, using only black and white colors. 3.2 Implementation 15