Discrete Logic Replacement Melody Player

Similar documents
An Enhanced MM MHz Generator

Embedded Systems. Interfacing PIC with external devices 7-Segment display. Eng. Anis Nazer Second Semester

Embedded Systems. Interfacing PIC with external devices 7-Segment display. Eng. Anis Nazer Second Semester

Distance, Velocity and Acceleration Detection

Experiment 3: Basic Embedded System Analysis and Design

Four Channel Digital Voltmeter with Display and Keyboard. Hardware RB0 RB1 RB2 RB3 RB4 RB5 RB6 RB7 RA0 RA1 RA2 RA3 PIC16C71

EXPERIMENT 2: Elementary Input Output Programming

Model Solution and marking scheme for Examination Paper EEE305J1: Microcontroller Systems 2004/5 General Observations

Introduction to PIC Programming

MECE336 Microprocessors I

SPI Serial Communication and Nokia 5110 LCD Screen

VikiLABS. a g. c dp. Working with 7-segment displays. 1 Single digit displays. July 14, 2017

Chapter 11 Sections 1 3 Dr. Iyad Jafar

Lab #10: Building Output Ports with the 6811

Design and Implementation of Timer, GPIO, and 7-segment Peripherals

Radio Clock with DCF77

Modbus for SKF IMx and Analyst

Lab 3: Timer and Clock

Q&A Watchdog Timer Configuration for DRV3205-Q1

AN202 LOW PIN-COUNT LCD INTERFACE. Relevant Devices This application note applies to the following devices: C8051F330, C8051F330D, C8051F331

ECE251 Intro to Microprocessors Final Exam December 14, 2015, 2 p.m.

DBt87xAN1. PCI Decoders Application Note Customizing PCI Decoder Drivers for Different Tuners

RS485 Index Command List.

RS485 Index Command List.

This document describes a program for 7-segment LED display (dynamic lighting) and key matrix and input.

TXZ Family. Reference Manual 12-bit Analog to Digital Converter (ADC-A) 32-bit RISC Microcontroller. Revision

AN1324 APPLICATION NOTE

This document describes a program for 7-segment LED display (dynamic lighting).

InfoVue OLED Display

PCIe-FRM21. User s Manual

EZ-LIGHT K50 Modbus Series Multicolor Indicators

Serial Remote Control of the RX2 SERIAL REMOTE CONTROL FOR THE RX2

PCI Decoders. Customizing PCI Decoder Drivers for Different Tuners. Application Note

Ross Video Limited USO RESTRITO. VANC Monitor User Manual

35058-TE. PLJ-6LED-A LED Frequency Display Module Manual

AT004 A10 Multi-Tester, 120 to 277 VAC Test Transceiver

Command line direct mode: This is relevant when a PC application is used to send and receive commands over the network port.

Nuvoton Touch Key Series NT086D Datasheet

SWITCH: Microcontroller Touch-switch Design & Test (Part 2)

ID ISC.LRU3000 ID ISC.LRU3500

Digital Compass. Package Contents. Hardware Overview. Basic Operation. Article: CNS-DC3 Quick Guide v1.0

EVALUATION BOARD DATASHEET EV-151

Lab 4: Hex Calculator

AN078. Getting Started. 1. Introduction

Engineering Bulletin. General Description. Provided Files. AN2297/D Rev. 0.1, 6/2002. Implementing an MGT5100 Ethernet Driver

IS01BFRGB LCD SmartDisplay from NKK Switches Simple implementation featuring the ATmega88PA from Atmel Complete software solution

16-CH Color Full Duplex Multiplexer Instruction Manual

DE2-115/FGPA README. 1. Running the DE2-115 for basic operation. 2. The code/project files. Project Files

Triple RTD. On-board Digital Signal Processor. Linearization RTDs 20 Hz averaged outputs 16-bit precision comparator function.

Digital (5hz to 500 Khz) Frequency-Meter

Using the Siemens S65 Display

Sapera LT 8.0 Acquisition Parameters Reference Manual

AN-1729 DP83640 IEEE 1588 PTP Synchronized Clock Output

DIGITAL TIMER - MODES- rev. 5.5

Manual MON-150W-SDI 15.6 SDI Monitor

Introduction to Mechatronics. Fall Instructor: Professor Charles Ume. Analog to Digital Converter

Design Problem 4 Solutions

NJU26125 Application Note PEQ Adjustment Procedure Manual New Japan Radio Co., Ltd

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

ADV7513 Low-Power HDMI 1.4A Compatible Transmitter

Figure 1: AHK1421 Evaluation Board Pictures.

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

EECS145M 2000 Midterm #1 Page 1 Derenzo

AN2421 Application note

Custom Installation Notes: Serial programming interface and IR remote commands for Arcam AVR400

Product Information. EIB 700 Series External Interface Box

HCS08 SG Family Background Debug Mode Entry

From the above diagram, the relationship between X1, X2, X a and C a is given by the following equations:

NS8050U MICROWIRE PLUSTM Interface

An Introduction to CY8C22x45

Training Document for Comprehensive Automation Solutions Totally Integrated Automation (T I A)

User s Manual. Document # , Rev 1.1, 05/27/05

ADP5520 Backlight Driver with I/O Expander Evaluation Board EVAL-ADP5520

Review of Sequential Logic Circuits

2-Wire Interfaced, 7-, 14-, and 16-Segment Alphanumeric Vacuum-Fluorescent Display Controller

16-BIT LOAD CELL/DUAL STATUS INPUT

Using the Siemens S65 Display

Section bit Analog-to-Digital Converter (ADC)

Fig. 1 Analog pins of Arduino Mega

Assignment #3: Piezo Cake

Keyboard Controlled Scoreboard

Sequential Logic. Introduction to Computer Yung-Yu Chuang

Introduction to S1210 EMI Pre-Compliance Test Software

Seven Segment Board. User Manual. 1.0, Oct 2011

Obsolete Product(s) - Obsolete Product(s) UM0223 User manual STEVAL-IFS001V1 evaluation kit with MEMS Introduction

ECE 2274 Pre-Lab for Experiment Timer Chip

ECE 4600 PROJECT. The 13 State Traffic Controller. Group #3 Anthony Ostrowski Jeffrey Ostrowski Derek Zoldos

University of Victoria. Department of Electrical and Computer Engineering. CENG 290 Digital Design I Lab Manual

S Fully Assembled and Tested S Software Control Through USB Port. S SMA Connectors for High-Speed Inputs and Output. Maxim Integrated Products 1

Modular DAA with 2/4 Wire Convertor. XE0002D Block Diagram

Application Note. RTC Binary Counter An Introduction AN-CM-253

7 Segment LED CB-035. ElectroSet. Module. Overview The CB-035 device is an, 8-digit 7-segment display. Features. Basic Parameters

STD-525T PRECISION TIMER

Main components Proximity and ambient light sensing (ALS) module

APPLICATION NOTE 4312 Getting Started with DeepCover Secure Microcontroller (MAXQ1850) EV KIT and the CrossWorks Compiler for the MAXQ30

Figure 30.1a Timing diagram of the divide by 60 minutes/seconds counter

All rights reserved. We advise readers to check that all parts are still available before commencing any project.

Assignment 3: 68HC11 Beep Lab

LCD Triplex Drive with COP820CJ

AtlonA 4x4 HDMI over CAT5 Matrix Switcher with IR Control AT-HD44M-SR. User Manual

Transcription:

Melody Player Author: Slav Slavov Sliven email: ell@sliven.osf.acad.bg Flow Chart: begin APPLICATION OPERATION : This application generates a melody. It was a little bit difficult to place the tables because of the program counter's 8 bits, but I found a way to do this. There are 8 melodies programmed in the PIC12C509 device. When you push the button a melody is played. Every melody finishes with " 0x0" which is the mark to stop playing. When the button is pressed again the next melody is played. There are two software generators of 7.5Hz and 100KHz. The first defines the continuation of the played note and the second gives the frequency of the played note. The 7.5Hz generator uses TMR0 and two flags (Flag.0 and Flag.1) to make the frequency. The 100KHz generator uses 10 instruction cycles to make the frequency. Here is a table of the used frequencies: B 0xCA 0x33 A# 0xD6 0x36 A 0xE4 0x39 G# 0xF0 0x3C G 0xFF 0x40 F# 0x44 F E D# 0x50 D C# 0xB4 C code is used for pause code 0x00 is used for stop mark Waiting for button press Increment the melody counter yes Is the counter >7? no melody counter = 0 note counter = 0 label: get note (Melody counter, note counter) no Is the note 0? yes begin yes Is the note 1? no play pause play note increment note counter label Microchip Technology Incorporated, has been granted a nonexclusive, worldwide license to reproduce, publish and distribute all submitted materials, in either original or edited form. The author has affirmed that this work is an original, unpublished work and that he/she owns all rights to such work. All property rights, such as patents, copyrights and trademarks remain with author. 1997 Microchip Technology Inc. DS40160A/4_018-page 1

Graphical hardware representation: 5V 3W/8ohm PIC12C509 GP1 1K b e C KT805AM GND GP0 Switch GND Bill of Materials (BOM): Part# PIC12C509 Switch Speaker Resistor 1K KT805AM Manufacturer MICROCHIP DS40160A/4_018-page 2 1997 Microchip Technology Inc.

APPENDIX A: SOURCE CODE ;**************************************************************** ; MLDY509.ASM ; ;**************************************************************** LIST p=12c509 #include "..\inc\p12c509.inc" config _WDT_OFF & _IntRC_OSC & _MCLRE_OFF & _CP_OFF RAM equ 0x07 ;Begining of RAM NumSongs equ.8 Out equ GPIO Speaker equ 2 In equ GPIO Btn equ 0 cblock RAM endc org Counter Flag Dta Melody Note Count1 Count2 0x00 begin ProgLp: ProgLoop ;------------------------------------------- GetNote: bcf bcf rlf bcf bcf bcf bcf STATUS,C Melody,W Melody1 Melody2 Melody3 Melody4 Melody5 Melody6 Melody7 1997 Microchip Technology Inc. DS40160A/4_018-page 3

DS40160A/4_018-page 4 1997 Microchip Technology Inc. Melody8 ;---------------------------------------- ; PINCO ;---------------------------------------- Melody1: 0xCA 0xCC 0xD6 0 ;--------------------------------------------- ; MENDELSON ;--------------------------------------------- Melody2:

1997 Microchip Technology Inc. DS40160A/4_018-page 5 0x0 ; A MELODY I

DS40160A/4_018-page 6 1997 Microchip Technology Inc. Melody3: 0x0 ; ENGLISH WALTZ Melody4:

0x0 begin: org 0x100 movwf OSCCAL ;calibrating the internal oscillator clrf movlw GPIO B'00111011' 1997 Microchip Technology Inc. DS40160A/4_018-page 7

main: TRIS movlw OPTION clrf GPIO B'10000111' Melody In,Btn $-1 Loop clrf Count1 movlw.52 movwf Count2 decfsz Count1,F $-1 Loop1: decfsz incf movlw subwf clrf clrf call movwf incf clrf call Count2,F Loop In,Btn main In,Btn main Melody,F NumSongs Melody,w STATUS,C Melody Note GetNote Dta Dta,F STATUS,Z main Note,F Flag ProgLp Loop1 ;--------------------------------------------------- ; Software cycle for 10 us that implements ; the hardware generator of 100KHz. Also a timer ; for about 7.5Hz is made for the continuation of the ; notes that are played. ; ;--------------------------------------------------- ProgLoop: Dta,W movwf Counter xorlw 1 btfss STATUS,Z Out,Speaker ;sets the output to high ;------------------------------------- ;100KHz (10us) generator ProgLoop1: DS40160A/4_018-page 8 1997 Microchip Technology Inc.

btfss TMR0,7 Flag,0 Flag,0 ProgDelay1 TMR0,W STATUS,Z Flag,1 BackProgDelay1: decfsz Counter,F ProgLoop1 Prog2 ProgDelay1: BackProgDelay1 ; ;-------------------------------------- Prog2: movwf Dta,W Counter bcf Out,Speaker ;sets the output to low ProgLoop2: btfss TMR0,7 Flag,0 Flag,0 ProgDelay2 TMR0,W STATUS,Z Flag,1 BackProgDelay2: ProgDelay2: ProgLoop3 decfsz btfss return clrf Counter,F ProgLoop2 ProgLoop3 BackProgDelay2 Flag,1 ProgLoop Flag,7 Flag Flag,7 ProgLoop org 0x200 ; SLEEP BABE SLEEP Melody5: 1997 Microchip Technology Inc. DS40160A/4_018-page 9

DS40160A/4_018-page 10 1997 Microchip Technology Inc.

1997 Microchip Technology Inc. DS40160A/4_018-page 11 0x0 ; A MELODY II Melody6: 0x84 0xB4 0xB4 0xB4 0x50 0x50 0x50

DS40160A/4_018-page 12 1997 Microchip Technology Inc. 0x0 ; FINAL COUNTDOWN Melody7: 0x0

1997 Microchip Technology Inc. DS40160A/4_018-page 13 ; IN THE MORNING Melody8:

0x0 END DS40160A/4_018-page 14 1997 Microchip Technology Inc.