page 1 of 6

Similar documents
AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

Pmod peripheral modules are powered by the host via the interface s power and ground pins.

ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

Display Board Pulse Width Modulation (PWM) Power/Speed Controller Module

Apple iphone/ipod Touch - ieffect Mobile Guitar Effect Accessory & Application

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Owner s Manual AWM910 JENSEN AWM910 COMPACT DISC PLAYER RADIO CD COMPACT MUSIC SYSTEM MUTE AUX BAND AUX IN PUSH PUSH PWR VOL ALARM T/F AUD SPK A SPK B

THE ELEMENT SUPPORT OPERATING INSTRUCTIONS AMP+DACS ONLINE BY PHONE BY MAIL

AVR Butterfly Training. Atmel Norway, AVR Applications Group

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Electronic Circuits Spring 2007

TerraTec Electronic GmbH, Herrenpfad 38, D Nettetal, Germany

Pulse Width Modulation

Direct Digital Amplification (DDX ) The Evolution of Digital Amplification

The modular concept of the MPA-3 system is designed to enable easy accommodation to a huge variety of experimental requirements.

The audio input connection on your computer

Build A Video Switcher. Reprinted with permission from Electronics Now Magazine September 1997 issue

PRODUCT SHEET OUT1 SPECIFICATIONS

DR-1 Portable Digital Recorder OWNER'S MANUAL

Roxio Easy LP to MP3 Getting Started Guide

BlueGate. Your easy to use reference for getting the most out of your product USER GUIDE. Enjoy FREE REGISTRATION

User Manual CABLE TESTER CT100. Professional 6-in-1 Cable Tester

Smarthome SELECT Bluetooth Wireless Stereo Audio Receiver and Amplifier INTRODUCTION

Wireless In-Ear Audio Monitor

Digitizing Sound Files

miditech Audiolink II

CHAPTER 11: Flip Flops

QLINK User Manual Stereo Audio Transmitter

11: AUDIO AMPLIFIER I. INTRODUCTION

Flexible Active Shutter Control Interface using the MC1323x

Timer A (0 and 1) and PWM EE3376

Real-Time Clock. * Real-Time Computing, edited by Duncan A. Mellichamp, Van Nostrand Reinhold

Phase II Design for a Multiband LMR Antenna System

USER MANUAL. 914 Power Amplifier MODEL: P/N: Rev 1

Designing an Induction Cooker Using the S08PT Family

KEYBOARD EXTENDED RANGE. Sixty Owner, s Manual P/N

Pulse Width Modulation Applications

Mbox Basics Guide. Version 6.7 for LE Systems on Windows XP or Mac OS X. Digidesign

Basics. Mbox 2. Version 7.0

HomePlug adapters for transferring music and speech over your household power circuit

Pulse width modulation

QUALITY AV PRODUCTS INMATE/INMATE USB PROFESSIONAL 19" MIXER. User Guide and Reference Manual

Traktor Audio Configuration

Lab Experiment 1: The LPC 2148 Education Board

EMC6D103S. Fan Control Device with High Frequency PWM Support and Hardware Monitoring Features PRODUCT FEATURES ORDER NUMBERS: Data Brief

Automatic Miniblinds System. San Jose State University. Department of Mechanical and Aerospace Engineering. Brian Silva Jonathan Thein

The basic set up for your K2 to run PSK31 By Glenn Maclean WA7SPY

User Manual. For additional help please send a detailed to Support@phnxaudio.com. - 1 Phoenix Audio Technologies

EDIC-mini Tiny model A39

Kit Watt Audio Amplifier

Decimal Number (base 10) Binary Number (base 2)

Active Speaker System LX523 AUDAC PROFESSIONAL AUDIO EQUIPMENT. Active Speaker System with remote input LX523. User Manual & Installation Guide

PCX9 for PCI Professional Digital Audio Card

User Manual. Please read this manual carefully before using the Phoenix Octopus

MODEL 2202IQ (1991-MSRP $549.00)

PCAN-MicroMod Universal I/O Module with CAN Interface. User Manual. Document version ( )

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Accurate Measurement of the Mains Electricity Frequency

25. AM radio receiver

Pulse Width Modulation (PWM) LED Dimmer Circuit. Using a 555 Timer Chip

MP3 Player CSEE 4840 SPRING 2010 PROJECT DESIGN.

POCKET SCOPE 2. The idea 2. Design criteria 3

Web Site: Forums: forums.parallax.com Sales: Technical:

Features, Benefits, and Operation

Ping Pong Game with Touch-screen. March 2012

Final Project Example

MANUAL PC1000R

Lab 1: Introduction to Xilinx ISE Tutorial

UM Discrete Class D High Power Audio Amplifier. Document information

User guide. Stereo Bluetooth Headset SBH50

D A. TASCAM PCM Recorder. iphone/ipad/ipod touch Application USER'S GUIDE

PSP3. Stereo M/S preamplifier. User manual

Analog Representations of Sound

Analog to Digital Conversion of Sound with the MSP430F2013

BXR. Owner, s Manual. One hundred BASS EXTENDED RANGE P/N

Ultimate USB & XLR Microphone for Professional Recording

VMR6512 Hi-Fi Audio FM Transmitter Module

VIEW. SLX300 SpeakerLinX IP Zone. Amplifier Installation and Setup Guide. AVoIP

1/22/16. You Tube Video. Definitions. Duty Cycle: on-time per period (specified in per cent)

EVOline Multimedia Modules

Music On Hold and Paging

CONTENTS. Zulu User Guide 3

INTRODUCTION. Please read this manual carefully for a through explanation of the Decimator ProRackG and its functions.

mdm-mp3 minidirector with MP3 Player

ARRL Morse Code Oscillator, How It Works By: Mark Spencer, WA8SME

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

Suddenly everyone wants to sit in the back.

CINEMA SB100 powered soundbar speaker

PG-01instruction manual

Unattended Answering Device Instruction Manual

2 X 250Watt Class D Audio Amplifier Board IRS2092 User s Guide

Voice Dialer Speech Recognition Dialing IC

What you will do. Build a 3-band equalizer. Connect to a music source (mp3 player) Low pass filter High pass filter Band pass filter

Safety Warnings and Guidelines

1 All safety instructions, warnings and operating instructions must be read first.

Jitter in (Digital) Audio

Transcription:

Lab Project 9: Generating Musical Notes Using the Amplifier Module For more info: support@digilent.ro Revision: September 2, 2009 Overview The information that follows refers to the implementation of an application using the Digilent PmodAMP1 Speaker/Headphone Amplifier Module. This document describes the module s capabilities, as well as the features used to send a signal to the module. Bold numbers in brackets refer to the bibliography below. PmodAMP1 Speaker/Headphone Amplifier Module The PmodAMP1 amplifies low power audio signals to drive either stereo headphones or a monophonic speaker. The speaker is driven from the left stereo input. The audio inputs to the module are provided through a Digilent 6-pin Pmod connector. A 1/8-inch stereo audio jack is used for the headphone output and a 1/8-inch mono audio jack is used for the speaker output. Unlike most Digilent Pmods, which accept only digital inputs, the PmodAMP1 accepts analog inputs as well as pulse width modulated digital inputs.[2] Features of the PmodAMP1 include: a National Semiconductor LM4838 audio amplifier IC a 1/8-inch stereo headphone jack a 1/8-inch mono speaker jack a 6-pin header for inputs 3V-5V operating voltage [2] Usage The PmodAMP1 accepts either digital or analog inputs. The input voltage range is 0-Vcc. Typically the module uses power supplied by a Digilent system board and is operated at 3.3V. The maximum power supply voltage is 5.0V. The inputs for the amplifier and the power to the module are provided on connector J1. The PmodAMP1 provides a band-pass filter on the input with a high pass cutoff frequency of approximately 150Hz and a low pass cutoff frequency of approximately 8KHz. A digital input is typically a pulse width modulated (PWM) signal generated by a digital output from a Digilent programmable logic system board. The low pass filter on the input acts as a reconstruction filter to convert the pulse width modulated digital signal into an analog voltage on the amplifier input. The PmodAMP1 also accepts analog inputs with an input voltage range of 0-Vcc. These inputs are typically the output of an analog to digital converter module, like the Digilent PmodDA1 or PmodDA2, but could also be a line level signal from some other audio source. The output of a digital to analog converter module typically has a voltage range of 0-3.3V and should have a sample rate of at least 16Khz. The low pass filter on the input again acts as a reconstruction filter and removes the high frequency artifacts introduced by the sampling process. A line level input, www.digilentinc.com page 1 of 6

like the output of a portable CD player or MP3 player, is typically a 1V peak-to-peak analog voltage. [2] The input voltage, from whatever signal source is used, is filtered by the input band-pass filter, amplified, and then sent to the output jacks to drive either a speaker or headphones. Connector J2 is the speaker output. Connector J3 is the headphone output (see Figure 1). Both headphones and a speaker can be connected and driven simultaneously. The potentiometer, R2, is a volume control and can be used to adjust the output level. In Figure 2, the order of the pins of input connector J is shown. It can be seen that two of the pins are left unconnected, maybe for future purposes. [2] The PmodAMP1 is typically used with a Digilent programmable logic system board generating pulse width modulated digital outputs or generating analog output via a digital to analog converter module. Most Digilent system boards, like the Basys and Nexys, have 6-pin connectors that allow the PmodAMP1 to plug directly into the system board or to connect via a Digilent 6-pin cable. [2] For more information about the operation and features of the LM4838 audio amplifier IC, refer to [4]. Figure 1 Block Diagram Example Project Figure 2 Input Connector J1 The project presented uses the PmodAMP1 to receive digital signals in order to generate the musical notes of the diatonic scale. Each of these notes has a certain generation frequency, and according to that, the sound having that frequency is the corresponding note. The application generates each note for a second. In order to do that, the Timer 0 and 1 interrupts were used; Timer1 for a second interrupt, with an index that has the maximum value 7, to ensure that all seven notes have been played; Timer0 www.digilentinc.com page 2 of 6

changes the value of TCNT register every second, and is loaded with different values corresponding to the frequencies of the musical notes. Main Function Software Diagram Start Timers and ports initialization The Timer0ChangeValues function call Timer0 and 1 interrupts sound generation Figure 3 Main Function Diagram Timer1 Interrupt Function The interrupt occurs every second and increments a variable until it reaches the value of 7, then resets it. At the end, it reloads the TCNT registers. The code is as follows: ISR(TIMER1_OVF_vect) j=j+1; //increments the variable for changing the frequency every second if (j==7) //reset j if all notes have been played j=0; TCNT1H=0xE1; TCNT1L=0x7B; Timer0 Interrupt Function //one second interrupt This timer manages the frequencies for musical notes. According to the variable for selecting the value for TCNT, this function changes the TCNT0 register, thus the time interval at which the interrupt occurs. The code is as follows: ISR(TIMER0_OVF_vect) www.digilentinc.com page 3 of 6

PORTD=~PORTD; //toggles port D TCNT0=low[j]; //loads the timer register with the corresponding value for each sound frequency Timers Initialization Function The normal operation mode is selected, for counting, the overflow type of interrupt and the 1024 value for prescaler. The Timer1 TCNT register is also loaded with the corresponding value for one second interrupt. void Timer1Init(void) TCCR1A=0x00; TCCR1B=0x05; TCCR0=0x07; TIMSK=0x05; TCNT1H=0xE1; TCNT1L=0x7B; //normal mode operation //1024 prescaler //1024 prescaler for timer0, normal mode operation //enables interrupts //one second interrupt Timer0 Values Function The values for Timer0 result from the frequencies of each musical note. Using the mode of number calculation presented in Lab Project 2, the interrupt timing is determined as the period of each note. Since there are seven musical notes, for each of them there is a certain frequency and a certain interrupt timing. The code is presented below. void Timer0ChangeValues(void) low[0]=0xe2; // Do note low[1]=0xe5; // Re low[2]=0xe8; // Mi low[3]=0xe9; // Fa low[4]=0xec; // Sol low[5]=0xee; // La low[6]=0xf0; // Si Tasks 1. Create a new project with two headers like in the previous projects and then in the text editor copy the functions presented above and the lines from the first part of the project found at the end of the document. 2. Implement the same type of application but change the values to be loaded in the TCNT0 register; this is equivalent to changing the scale of the musical notes. Compute the values for higher frequencies. 3. In this lab project you learned the PmodAMP1 s capabilities and you now know that beside the digital signals allowed at the PmodAMP1 s output, there are analog ones, too. Try to implement an application in which you use the information from Lab Project 8 to generate different waveforms, and see what the corresponding sound is like. www.digilentinc.com page 4 of 6

Tip: You have to connect the PmodAMP1 to the output of PmodDA1 in order to be able to receive an analog signal. www.digilentinc.com page 5 of 6

Bibliography [1] http://www.atmel.com/dyn/resources/prod_documents/2490s.pdf [2] http://digilentinc.com/data/products/pmod-amp1/pmodamp1_rm_revb.pdf [3] http://digilentinc.com/data/products/pmod-amp1/pmodamp1_rm_revb.pdf [4] http://www.national.com/ds/lm/lm4838.pdf [5] http://en.wikipedia.org/wiki/note [6] http://liutaiomottola.com/formulae/freqtab.htm Application Source Code /* Include File Definitions */ #include <stdio.h> #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include "CerebotII.h" #include "StdTypes.h" /* Global Variables */ int i,j=0; char low[7]; /* Forward Declarations */ void DeviceInit(); void Timer1Init(); void Timer0ChangeValues(); www.digilentinc.com page 6 of 6