Order this document by TBD Preliminary Application Note Audio Generation by DragonBallTM MC68EZ328 PWM Output INTRODUCTION This document describes an method of audio generation using DragonBallTM MC68EZ328 PWM Output. The Pulse Width Modulation (PWM) module of DragonBallTM-EZ will modulate the audio signal into a pulse train of fixed periods but changing width. The changing width of the pulses corresponds to the voltage level of the sine wave. A simple RC circuit, fourth-order low pass filter and audio amplifier are used to convert the PWM signal into audio signal. This circuit has been tested with audio sample at 16kHz and 32kHz reconstruction rate. The output sound quality is as good as an AM radio. Figure 1. Block Diagram HARDWARE The audio generation circuit consists of a RC circuit, four-order low pass filter, audio amplifier and speaker. The RC circuit and Low Pass Filter is used for harmonics and carrier frequency generated by PWM signals. The audio amplifier will drive the speaker to generate the audio. RC CIRCUIT The RC circuit (Figure 2) is for attenuation and filtering harmonics of the PWM signals. It prevents the saturation of the low pass filter and the audio amplifier. After passing the signal to this RC circuit, the signal will change to a trangular wave. Figure 3 shows the ouput waveform of the RC circuit. The amplitude of each trangular wave is proportional to the value of each sample. This document contains information on a product under development. Motorola reserves the right to change or discontinue this product without notice. SEMICONDUCTOR PRODUCT INFORMATION 1996 Motorola, Inc. All Rights Reserved. . Figure 2. RC Circuit. PWM OUTPUT SIGNAL RC CIRCUIT OUPUT SIGNAL Figure 3. Output Waveform of the RC circuit. 2 DragonBallTM MC68EZ328 Application Notes MOTOROLA FOURTH-ORDER LOW PASS FILTER Figure 4 shows the schematic of the low pass filter. This four-order low pass filter is consisted of LM385 Low Power Op-Amp. It removes most of the harmonic generated by the PWM output waveform. The cut-off frequency of the circuit is about 21kHz. Figure 4. Fourth-order Butterworth Low Pass Filter. AUDIO AMPLIFIER The MC34119 Low Power Audio Amplifier is chosen for this application. This amplifier has the Chip-Disable (CD) pin, which can be set high to shut down the amplifier when it is not in use, thus minimizing the power consumption of the system. Figure 5. Audio Amplifier. The gain of the amplifier is calculated by the following equation. R32 Gain = 2 × ---------R33 MOTOROLA DragonBallTM MC68328 Application Notes 3 SOFTWARE In order to minimize the size of data storing the sound samples, the sound samples is at 8kHz sampling rate. It is because the human can heard the 8kHz carrier frequency. So, we need to set the reconstruction rate of PWM output to 32kHz and repeat the same sample to PWM output three times. Figure 6 shows the diference between the PWM output waveforms with reconstruction rate at 8kHz, 16kHz and 32kHz. The number of repetitions of each sample and reconstruction rate can be selected by changing the PWM Control Register of MC68EZ328. The DragonBallTM-EZ User’s Manual will describe the details of programming the PWM module. A example program will be attached with this document. Figure 6. Waveform of PWM Output. 4 DragonBallTM MC68EZ328 Application Notes MOTOROLA APPENDIX: EXAMPLE AUDIO GENERATION CIRCUIT MOTOROLA DragonBallTM MC68328 Application Notes 5 A B C D 1 ~SOUND_EN PWMO VR2 5K 2 R34 10K R35 10K 3 R30 100 C40 4700p 3 VCC + - Q4 BC857 U10A 1 R36 10K 4 R37 10K C41 4700p 5 6 + - R41 2 R40 10K C46 4700p R39 39K LM358 R38 1.2K 3 39K C45 4700p LOW PASS FILTER POWER ENABLE C47 4700p 2 4 5 C39 0.1u U10B 7 LM358 5 6 R33 3K 6 3 2 1 4 7 7 6 7 5 8 R31 VOUT1 VOUT2 100 CD VIN VCC GND MC34119 FC1 FC2 U9 R32 75K C48 4.7u LOW POWER AUDIO AMPLIFIER 0.1u C43 C42 0.1u Audio Generation Circuit with Enable Circuit ~SOUND_EN PWMO 1 8 4 8 4 VCC BC857 Q5 C44 0.1u LS1 8 SPEAKER 8 A B C D 10 A B C D U10A 10K R36 E 10K R37 C41 4700p 6 VCC + - F 7 U10B G G R33 3K H R32 75K 1 4 3 2 CD VIN VCC GND VOUT1 VOUT2 U9 FC1 FC2 MC34119 H LOW POWER AUDIO AMPLIFIER 0.1u C43 C42 0.1u Audio Generation Circuit without Enable Circuit VCC + - 1 5 8 6 7 VCC I C44 0.1u LS1 SPEAKER J 10 1 2 3 4 5 6 9 C40 4700p 2 LM358 F C48 4.7u 9 R35 10K 5 J 8 R34 10K R41 C46 4700p R40 10K LM358 R39 39K C45 4700p 3 I 8 PWMO C47 4700p R38 1.2K D 39K LOW PASS FILTER C E 7 PWMO VR2 5K B 7 6 5 4 3 2 1 A 8 4 8 4