Programmable SLI AT94K AT94S. Application Note. DTMF Generator

Similar documents
8-bit RISC Microcontroller. Application Note. AVR314: DTMF Generator

8-bit Microcontroller. Application Note. AVR400: Low Cost A/D Converter

8-bit RISC Microcontroller. Application Note. AVR182: Zero Cross Detector

Low-power Flasher IC with 18-m Shunt U6432B

MHz High Linearity SiGe Active Receive Mixer T0782. Preliminary

1000-MHz Quadrature Modulator U2790B. Features. Benefits. Description. Electrostatic sensitive device. Observe precautions for handling.

Application Note. 8-bit Microcontrollers. AVR092: Replacing ATtiny11/12 by ATtiny13. Features. Introduction

Zero-voltage Switch with Adjustable Ramp T2117

Read-only Transponder TK5530

ATA6140. Flasher Application Module. Application Note. ATA Flasher Application Module. 1. Description

Current Monitor IC U4793B

Flasher, 30 mω Shunt, Pilot Lamp to GND or V Batt U2043B

Flasher, 18-mΩ Shunt, Frequency Doubling Disabling U6433B

Flasher IC with U643B

8-bit Microcontroller. Application Note. AVR084: Replacing ATmega323 by ATmega32. Features. Introduction. ATmega323 Errata Corrected in ATmega32

PWM Power Control IC with Interference Suppression U6083B

Digital Window Watchdog Timer U5021M

AVR443: Sensor-based control of three phase Brushless DC motor. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Standard Read/Write ID Transponder with Anticollision TK5551

High-speed CAN Transceiver ATA6660

300-MHz Quadrature Modulator U2793B

Zero-voltage Switch with Adjustable Ramp T2117

Transceiver Base Station Board ATAB542x-x-B. Application Note. Bill of Materials and Implementation of the Transceiver Base Station Board ATAB542x-x-B

8-bit Microcontroller. Application Note. AVR083: Replacing ATmega163 by ATmega16

Special Fail-safe IC U6808B

UHF ASK Transmitter U2745B

8-Megabit (1M x 8) OTP EPROM AT27C080. Features. Description. Pin Configurations

Transceiver Base Station Board ATAB5823-x-B/ ATAB5824-x-B. Application Note

AVR443: Sensorbased control of three phase Brushless DC motor. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

IR Receiver for Data Communication U2538B

Application Note. 8-Bit Microcontrollers. AVR433: Power Factor Corrector (PFC) with AT90PWM2 Re-triggable High Speed PSC

Application Note. How to Connect C51 Microcontroller to ATR Microcontrollers

Rear Window Heating Timer/ Long-term Timer U6046B

Read/Write Crypto Transponder for Short Cycle Time TK5561A-PP

2.4-GHz SiGe Power Amplifier for b/g WLAN Systems T7031. Preliminary

AT91 ARM Thumb Microcontroller s. AT91R40807 Electrical Characteristics

Low-power Audio Amplifier for Telephone Applications U4083B

UHF ASK/FSK Transmitter U2741B

ATAVRAUTO User Guide

AVR055: Using a 32kHz XTAL for run-time calibration of the internal RC. 8-bit Microcontrollers. Application Note. Features.

Two-relay Flasher ATA6140

Low-cost Phase-control IC with Soft Start U2008B

3-wire Serial EEPROM AT93C86. Features. Description. Pin Configurations 8-lead PDIP. 16K (2048 x 8 or 1024 x 16)

8-bit Microcontroller. Application Note. AVR085: Replacing AT90S8515 by ATmega8515. Features. Introduction. AT90S8515 Errata Corrected in ATmega8515

1-Megabit (128K x 8) OTP EPROM AT27C010

Smart RF AT86RF401-EK1. Application Note. AT86RF401-EK1 Smart RF MicroTransmitter Evaluation Kit Application Note. Functional Description

3-wire Serial EEPROM AT93C86. Features. Description. Pin Configurations. 16K (2048 x 8 or 1024 x 16)

Time-code Receiver T4227

2-megabit (256K x 8) Unregulated Battery-Voltage High-speed OTP EPROM AT27BV020

2-Megabit (128K x 16) OTP EPROM AT27C2048

1-Megabit (64K x 16) OTP EPROM AT27C1024

Very Highresolution. Linear CCD Image Sensor (12000 Pixels) TH7834C. Features. Description

Application Note. Preliminary. 8-bit Microcontrollers

8-bit Microcontroller. Application Note. AVR086: Replacing AT90S8535 by ATmega8535

Power Meter Front End Design: The Delta Connection. Application Note. Power Meter Front End Design: The Delta Connection. Three-Phase Basics

Phase Control IC for Tacho Applications U209B

UHF ASK/FSK. Transmitter T5754

Phase-control IC with Current Feedback and. Overload. Protection U2010B

3-wire Serial EEPROM AT93C86A. Preliminary. Features. Description. Pin Configurations. 16K (2048 x 8 or 1024 x 16) VCC DC ORG GND CS SK DI DO

ATAK57xx Software Description. Application Note. Preliminary. Software Description RF Design Kit ATAK57xx. Description

AT91 ARM Thumb Microcontrollers. AT91R40008 Electrical Characteristics. Features. Description

Highperformance EE PLD ATF16LV8C

8-bit RISC Microcontroller. Application Note. AVR042: AVR Hardware Design Considerations

128-bit Read-only IDIC for RF Identification. e5530

L-band Down-converter for DAB Receivers U2730B-N. Preliminary

Read/Write Base Station U2270B

Standard R/W IDIC (264 Bit) with Integrated Capacitance T5554. Preliminary. Features. Description. System Block Diagram

Multifunction Timer IC U2102B

Read/Write Transponder TK5552

Power Management AT73C211

4-Megabit (512K x 8) OTP EPROM AT27C040. Features. Description. Pin Configurations

AT91 ARM Thumb Microcontrollers. AT91M42800A Electrical Characteristics

Battery-Voltage. 1-Megabit (64K x 16) Unregulated. High-Speed OTP EPROM AT27BV1024. Features. Description. Pin Configurations

Battery-Voltage. 1-Megabit (128K x 8) Unregulated OTP EPROM AT27BV010. Features. Description. Pin Configurations

AVR053: Calibration of the internal RC oscillator. 8-bit Microcontrollers. Application Note. Features. Introduction

AT91 ARM Thumb Microcontrollers. AT91R40008 Electrical Characteristics


AVR122: Calibration of the AVR's internal temperature reference. 8-bit Microcontrollers. Application Note. Features.

8-bit Microcontroller. Application Note. AVR040: EMC Design Considerations. Scope. Introduction

8-bit Microcontroller. Application Note. AVR081: Replacing AT90S4433 by ATmega8. Features. Introduction. AT90S4433 Errata Corrected in ATmega8

Highperformance EE PLD ATF22V10B. Features. Logic Diagram. Pin Configurations. All Pinouts Top View

Standard Read/Write Crypto Identification IC. e5561

UHF ASK/FSK Receiver ATA5721 ATA5722. Features

Highperformance EE PLD ATF22V10B ATF22V10BQ ATV22V10BQL

AVR1311: Using the XMEGA Timer/Counter Extensions. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Low-noise, High-dynamicrange. Antenna Amplifier IC ATR4251. Preliminary

8-bit Microcontroller. Application Note. AVR080: ATmega103 Replaced by ATmega128

Power Management for Mobiles (PM) AT73C202 Power and Battery Management Unit for Cellular Phone. Preliminary. Features.

Rad Hard 16 MegaBit SRAM Multi Chip Module AT68166F AT68166FT. Preliminary

AVR1302: Using the XMEGA Analog Comparator. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

512K (64K x 8) Multiplexed. Addresses/Outputs. Low-voltage OTP EPROM AT27LV520

Requirements of ISO/IEC Type B Proximity Contactless Identification Cards. Application Note

UHF ASK. Receiver T5744

Low IF WDCT 5.8 GHz Transceiver ATR2820. Preliminary

AVR440: Sensorless Control of Two-Phase Brushless DC Motor. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

125 khz Transmitter IC for TPM ATA5275

Intelligent Stepper Motor Driver ATA6830

Multifunctional 330-bit Read/Write RF Sensor Identification IC ATA5570. Preliminary

8-bit Microcontroller with 2K Bytes In-System Programmable Flash. ATtiny261A. Appendix A. Appendix A ATtiny261A Specification at 105 C

Power Management for Mobiles (PM) AT73C204. Features. Description

Transcription:

DTMF Generator Features Generation of Sine Waves Using PWM (Pulse-Width Modulation) Combine Different Sine Waves to DTMF Signal AT94K Top-Module Design 260 Bytes Code Size and 128 Bytes Constants Table Size Use of Look-Up Tables Introduction This application note describes how Dual-Tone Multiple Frequencies (DTMF) signaling canbeimplementedusingthefpslic embedded AVR microcontroller with PWM and SRAM. Applications such as phones are using DTMF signals for transmitting dialing information. There are two frequencies added together to generate a valid DTMF signal, a low frequency (f b ) and a high frequency (f a ). Table 1 shows how the different frequencies are mixed to form DTMF tones. The Assembly code with the DTMF Generator routines can be found in the FPSLIC Software section of the Atmel web site (http://www.atmel.com), under the 2816.asm archive. Programmable SLI AT94K AT94S Application Note Figure 1. DTMF Generator V CC V CC PE6 AT94K PD7 PD0 1 2 3 A 4 5 6 B 7 8 9 C * 0 # D PB4 PB5 PB6 PB7 XTAL1 XTAL2 PB0 PB1 PB2 PB3 22 pf 8 MHz 22 pf Rev. 1

Table 1. DTMF Tone Matrix fb/fa 1209 Hz 1336 Hz 1477 Hz 1633 Hz 697 Hz 1 2 3 A 770 Hz 4 5 6 B 852 Hz 7 8 9 C 941 Hz * 0 # D The rows of the matrix shown in Table 1 represent the low frequencies while the columns represent the high frequency values. For example, this matrix shows that digit 5 is represented by a low frequency of f b = 770 Hz and a high frequency of f a =1336 Hz. The two frequencies are transformed to a DTMF signal using equation 1: f () t = A a sin( 2π f a t ) + A b sin( 2π f b t) ) ( 1) where the ratio between the two amplitudes should be: A b A a = K 07, < K < 09, ( 2) Theory of Operation Generating Sine Waves Starting from a general overview about the usage of the PWM, it will be shown how the PWM allows to generate Sine waves. In the next step, an introduction is given in how frequencies that are different from the ground frequency of the PWM can be generated. After closing the theoretical introduction with the DTMF signal itself, the implementation will be described. According to the relation between high level and low level at the output pin of the PWM, the average voltage at this pin varies. Keeping the relation between both levels constant generates a constant voltage level. Figure 2 shows the PWM output signal. Figure 2. Generation of a Constant Voltage Level V V H V AV V L x y t 2 DTMF Generator

DTMF Generator Equation 3 shows how to calculate the voltage level: xv V H + yv L AV = ------------------------- ( 3) x + y A sine wave can be generated if the average voltage generated by the PWM is changed every PWM cycle. The relation between high and low level has to be adjusted according to the voltage level of the sine wave at the respective time. Figure 3 visualizes this scheme. The values for adjusting the PWM can be calculated every PWM cycle or stored in a look-up table (LUT). Figure 3 also shows the dependency between frequency of the ground sine wave and the amount of samples. The more samples (Nc) are used, the more accurate the output signal gets. At the same time the frequency sinks. Equation 4 shows this correlation: f f l f ------ CK 510 = = --------------------- ( 4) Nc Nc f: Sine wave frequency (1/T) f L PWM frequency (f CK /510) T: Period of ground sine wave f CK : Timer Clock Nc: Number of samples (12 in Figure 3) The PWM frequency is dependent on the PWM resolution. For an 8-bit resolution, the Timer TOP value is 0xFF (255). Because the timer counts up and down this value has to be doubled. In dividing the Timer Clock f CK by 510 the PWM frequency can be calculated. According to this coherence a Timer Clock of 8 MHz generates a PWM frequency of 15.6 khz. Modifying the Frequency ofthesinewave Figure 3. Generating a Sine Wave with PWM V 1 2 3 4 5 6 7 8 9 10 11 12 t 1/fl T 3

The sinusoid samples for adjusting the PWM are not read in a sequentially manner from the look-up table (LUT), but just every second value. At the same sample frequency an output signal with twice the frequency is generated, see Figure 4. Figure 4. Doubling the Output Frequency (X SW =2) V 1 2 3 4 5 6 7 8 9 10 11 12 t 1/fl T/2 T In using not every second sample but every third, fourth, fifth... it is possible to generate Nc different frequencies in the range from [1/T Hz.. 0 Hz]. Note: For high frequencies it will not be a sine wave anymore. The step-width between samples is specified by X SW. Equation 5 describes this relation: X SW = f Nc ------ = ---------------------- fnc510 ( 5) f l F CK Equation 6 shows how to calculate the value with which the PWM has to be adjusted every PWM cycle (Timer overflow). Based on the value of the previous cycle (X' LUT )the new value (X LUT ) is calculated in adding the step-width (X SW ). X LUT = X' LUT + X SW ( 6) X' LUT : X LUT : Old position in look-up table New position in look-up table Adding the Two Different Frequencies to a DTMF Signal A DTMF signal has to be generated according to equations (1) and (2). Since this is easy to obtain with simple shift register operations a K-Factor of K = 3/4 has been chosen. Equation 6 shows how to calculate the look-up table position for adjusting the PWM. 3 f ( X LUT ) = f ( X LUTa ) + -- f ( X 4 LUTb ) ( 7) with X LUTa = X' LUTa + X SWa X LUTb = X' LUTb + X SWb 4 DTMF Generator

DTMF Generator 3 f ( X LUT ) = f ( X' LUTa + X SWa ) + -- f ( X' 4 LUTb + X SWb ) ( 8) Implementation of the DTMF Generator In this application a DTMF tone generator is built using one of the 8-bit PWM outputs (OC1A) and a sinusoid table with Nc = 128 samples each with n = 7 bits. The following equations show this dependency and shows how the elements of the LUT are calculated: 2Π x f( x) = 63+ 63 sin ----------- è æ 128 ø ö x [ 0 127] ( 9) The advantage in using 7 bits is that the sum of the high- and low-frequency signals fits in one byte. To support the whole DTMF tone set, we have to calculate eight X SW values, one for each DTMF frequency, and place them in a table. To achieve a higher accuracy, the following solution has been implemented: The X SW values calculated after equation 5 need only five bytes. To use all eight bytes to have a lower rounding error, this value is multiplied by eight. The pointer to the look-up table is saved in the same manner. But here two bytes are needed to store the actual value times eight. This means that three right shifts and a module operation with Nc have to be executed before using them as pointers to the sine values in the look-up table. Equation 10 shows the complete dependencies: X LUTa, b ROUND 1 8 -- X' 8 Nc f 510 = æ æ LUTa, bext + --------------------------öö ( 10) è è F øø CK X LUTa,b : Current position of element in LUT (actual format) X' LUTa,bExt : Previous position of element in LUT (extended format) 5

Figure 5. Schematics of the ATSTK94 Top-Module VCC CCLK INTP3 D0 TX1 RX1 TOSC2 TOSC1 INTP2 INTP1 TX0 RX0 XTAL2 XTAL1 INTP0 PD7 PE7 PE6 VCC PE5 PE4 PD6 PD5 SCL SDA CS0 PE3 PD4 PD3 PD2 PE2 PD1 PD0 PE1 PE0 RESET VCC 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 1 2 3 A 4 5 6 B 7 8 9 C * 0 # D PD3 PD2 PD1 PD0 PD4 PD5 PD6 PD7 The PWM signal is put out on the OC1A pin (PE6). An additional output filter will help to achieve a good sinusoid. If the PWM frequency is decreased, it can be necessary to implement a steeper filter to obtain a good result. The connection with the keypad is shown in Figure 1. The functionality of the keypad determines how the pressed key has to be evaluated. It has to be done in two steps: 1. Detecting the row of the pressed key - define low nibble of PORTD as output/zero value - define high nibble of PORTD as input/pull up - low bit in high nibble determines row 2. Detecting the column of the pressed key - define high nibble of PORTD as output/zero value - define low nibble of PORTD as input/pull up - low bit in low nibble determines column 6 DTMF Generator

DTMF Generator Figure 6 visualizes the functionality of the routine to detect a pressed key. The pressed key conditions the step width value. The interrupt routine uses this values to calculate the PWM settings for the two Sine Waves of the DTMF tone. The interrupt routine is shown in Figure 7 and Figure 8. The interrupt routine calculates the output compare value for the next PWM cycle. The interrupt routine first calculates the position of the next sample value in the LUT and read the value stored there. The position of the sample in the LUT is determined by the step-width. The step-width itself is determined by the frequency which is to be generated. Combining the sample values of the both DTMF frequencies using formula 7 gives the final output compare value of the PWM. Figure 6. Main Function Main Check Keypad Key Pressed? No Step-width a,b = 0 Yes Set Step-width a,b According the Pressed Key 7

Figure 7. Interrupt Service Routine Timer Overflow ISR Timer1_OVF X LUTaEXT = X LUTaEXT ' + X SW OCR_RelVal a = GetSample (X LUTaEXT ) X LUTbEXT = X LUTbEXT ' + X SW OCR_RelVal b = GetSample (X LUTbEXT ) OCR = OCR_RelVal a + 3/4 OCR_RelVal b Return Figure 8. Function GetSample GetSample X LUTa,b = (X LUTa,bExt + 4) / 8 X LUTa,b < 128 OCR_RelVal = f(x LUTa,b ) Return 8 DTMF Generator

Atmel Headquarters Corporate Headquarters 2325 Orchard Parkway San Jose, CA 95131 TEL 1(408) 441-0311 FAX 1(408) 487-2600 Europe Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland TEL (41) 26-426-5555 FAX (41) 26-426-5500 Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimhatsui East Kowloon Hong Kong TEL (852) 2721-9778 FAX (852) 2722-1369 Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan TEL (81) 3-3523-3551 FAX (81) 3-3523-7581 Atmel Operations Memory 2325 Orchard Parkway San Jose, CA 95131 TEL 1(408) 441-0311 FAX 1(408) 436-4314 Microcontrollers 2325 Orchard Parkway San Jose, CA 95131 TEL 1(408) 441-0311 FAX 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France TEL (33) 2-40-18-18-18 FAX (33) 2-40-18-19-60 ASIC/ASSP/Smart Cards Zone Industrielle 13106 Rousset Cedex, France TEL (33) 4-42-53-60-00 FAX (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 TEL 1(719) 576-3300 FAX 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland TEL (44) 1355-803-000 FAX (44) 1355-242-743 RF/Automotive Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany TEL (49) 71-31-67-0 FAX (49) 71-31-67-2340 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 TEL 1(719) 576-3300 FAX 1(719) 540-1759 Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France TEL (33) 4-76-58-30-00 FAX (33) 4-76-58-34-80 Atmel Programmable SLI Hotline (408) 436-4119 Atmel Programmable SLI e-mail fpslic@atmel.com FAQ Available on web site e-mail literature@atmel.com Web Site http://www.atmel.com Atmel Corporation 2002. Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company s standard warranty which is detailed in Atmel s Terms and Conditions located on the Company s web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel s products are not authorized for use as critical components in life support devices or systems. ATMEL and AVR are the registered trademarks of Atmel. FPSLIC is the trademark of Atmel. Other terms and product names may be the trademarks of others. Printed on recycled paper. 0M