Design of MP3 Player Based on AT89C51SND1C Microcontroller

As a high-quality music compression standard, MP3 is entering more and more people's lives, bringing a strong impact to the digital audio industry. MP3 can use this technology to obtain a larger music compression ratio, and can also get higher music playback quality, such as compressing music data in CD format into MP3 format, the sound effect is almost the same, and the file size can be compressed at least 12 times.

This article refers to the address: http://

It is precisely because of the small amount of data and the perfect playback effect of MP3 music that the transmission of music files suffixed with MP3 is realized on the network. At present, the MP3 player is developing in a powerful, rich appearance and low price. Here, a design scheme of an MP3 player based on the AT89C51SND1C microcontroller is proposed.

1 Introduction to MP3 encoding

MP3 is the abbreviation of MPEG Layer III (Layer 3 Audio Coding Standard). Figure 1 is the internal block diagram of the MP3 encoder. It is a compression method for super sound files with a digital compression rate of 128 Kb/s per channel. MPEG consists of two parts, audio and video, which can be compressed separately. MPEG is compressed on audio into MPEG Layer 1, MPEG Layer 2 and MPEG Layer 3, of which MP3 has the highest compression ratio of 12:1. In the case where there is generally no compressed data, when the audio is digitized, the sampling frequency must be more than twice the highest frequency of the actual sound.

1.jpg

At present, the best CD sound quality, the highest frequency of sound is 20 kHz, the sampling frequency is set to 44.1 kHz, 16-bit quantization, to obtain CD-quality stereo, the amount of data per second will exceed 1.4 Mb; and MP3 compression, data volume Can be reduced to 1/12, but the sound quality is not lost. If you further compress the amount of data to 1/24 or more, you can still maintain a fairly good sound quality, which is much better than reducing the sampling frequency and shortening the sampling depth.

2 MP3 player design

For portable MP3 systems, the main consideration is its small size, low power consumption, high capacity, and low price. The current popular MP3 players mainly include: single-chip control system, large-capacity mobile storage device, MP3 decoder, D/A conversion chip, audio amplifier circuit, USB interface, LCD display and keyboard circuit, etc. The basic working principle is shown in Figure 2. Shown. Through the USB interface, the digital music files in the MP3, WMA and other formats on the flash memory are sent to the integrated decoding chip of the single chip microcomputer for decoding, and the music files are decoded into digital signals, and then the audio DAC converts the digital audio signals through D/A conversion. Converted to an analog audio signal, then amplified by the power amplifier, and finally output music through the headphones.

2.jpg

This system mainly implements an MP3 player function. Because it involves file transfer and storage problems, it needs to implement USB memory function. The whole system consists of AT89C51SND1C (MCU), K9F2808U0A (Flash chip), power supply part, audio part, serial communication part and human-machine interface part.

MCU part: Controls the entire system, providing USB control and MP3 decoding. FLASH chip: store the entire system file. Power section: Provides the power required for system operation, including a boost and a buck section. Audio section: converts the data stream into a sound signal. Man-machine interface part: including buttons and LED indications. USB interface part: Download MP3 files through the USB interface of the PC.

2.1 Hardware Design

2.1.1 Controller section

The AT89C51SND1C is a multimedia 8-bit microprocessor developed by Atmel specifically for MP3 design requirements. It uses a common C51 core and integrates a CPU and hardware decoder to provide a convenient solution for MP3 design. The high integration of the chip greatly reduces the power consumption and heat generation of the system, improves the stability and speed of the system, and significantly enhances the anti-interference ability. It should be noted that due to the high frequency signals such as MP3 and USB transmission in the system, in order to avoid the influence of noise on the system, especially the audio output signal, an RC filter needs to be added between the positive and negative power supplies of the AT89C51SND1C. Circuitry to eliminate noise in the circuit. For the two analog voltage and digital power supplies of AVDD and UVDD, both need to be connected by a single bead at a single point in the digital ground and analog ground to avoid interaction between the digital power supply and the analog power supply.

2.1. 2 Audio section

Audio is the most important part of the whole system. It is easy to generate noise in the process of converting digital signals into analog signals. This is related to the sound effect of MP3 player. The system selects CS4330 chip, CS43 30 is compatible. Audio streams of 48 KHz, 44.1 KHz and 32 KHz. The sound data is input through the serial input pin SDATA. The left and right input clocks LRCK determine the left and right channels, and the data is sent to the CS4330 data buffer driven by the serial input clock SCLK, and the master clock determines the data filter. use.

2.1.3 Storage section

Samsung's NAND Flash K9F1208 is used as the data memory of the system to store the music files that the system needs to play. The communication between the main chip AT89C51SND1C and the flash memory is basically the same as that of reading the general memory RAM and EEPROM. The difference is that the two pins CLE and ALE are added, which is determined by the characteristics of Flash itself. The main chip reads whether the Flash read/write is completed by reading the R/B pin. If it is reading or writing, the pin is low, indicating that it is busy; if the read/write is completed, the pin level becomes high. In the READY state, waiting for the next operation. Both ALE and CLE signals are active on the rising edge, and the WP pin is write-protected to prevent data loss in the event of power supply instability due to switching.

2.1.4 Human Machine Interface Section

The human-machine interface part mainly provides an interface for information exchange between a person and a system, including keyboard input, LED display and serial port. The keyboard input provides the user with the ability to select functions, the current working state of the LED display system, the serial port can facilitate the debugging during the development process, and the system running condition is fed back to the screen of the PC through the tools such as the serial debugging assistant.

2. 1.5 USB interface section

Generally, the MP3 file is downloaded through the USB interface of the PC, and the transmission rate is 12 Mbps. Because the AT89C51SND1C chip produced by Atmel only supports the USB1.1 specification, the interface speed is slightly slower. But for MP3 playback, it can meet the needs.

2. 2 software design

The software design of the MP3 player system can be divided into the following parts according to the module:

â—†Flash storage part: This is the file storage system in the system. The Flash chip is divided according to the FAT file format. The operation of the chip must be performed in accordance with the FAT format.

â—† USB communication driver: USB driver communication mainly includes how to write the firmware program of the device according to the description of USB mobile hard disk in Windows 7, so that the operating system can operate the MP3 system.

â—† MP3 decoding control: The MP3 decoder in the middle of the control system decodes the MP3 compressed data stream taken out from the Flash into an audio data stream and provides it to the audio decoding interface.

â—† Audio decoding interface: Interface with the peripheral audio driver chip, configure and control the audio driver chip, convert the decoded digital signal into analog sound and drive the earphone.

â—† Other parts: It consists of a keyboard scan driver, LED display driver and digital tube driver that provide human-machine interface.

System software block diagram shown in Figure 3.

3.jpg

2.3 MP3 player structure

In the main program, if it is in the playing state, the PlayMP3 function is called to play the song until the last one is played. In PlayMP3, once the MP3 decoder starts working, it will always request data from the CPU until the song ends. After the program enters this function, only changing the keyboard operation of the current song can make this function end early and enter the next song.

The work of the MP3 player function is divided into two parts: the first part is to do some initialization work when playing a new MP3 song; the second part is waiting for the interrupt to occur. The second part is combined with the keyboard to implement user operations during MP3 playback. The block diagram of the MP3 player is shown in Figure 4.

4.jpg

2.4 Human Machine Interface Program Structure

When executing an MP3 program, it is necessary to control the playback of MP3 songs by pressing a button operation, and each key corresponds to a keyboard response function:

1Func: Function switching.

2Next: Backward.

3Previous: Forward.

4PlayPause: Play/Pause.

The human machine interface flow chart is shown in Figure 5.

5.jpg

Conclusion

This paper proposes the design scheme of MP3 player based on AT89C51SND1C single-chip microcomputer. MP3 adopts relatively complicated technology to obtain better compression effect, and the sampling rate of wideband audio signal is also higher (generally 44.1 KHz or more), so MP3 codec The amount of computation and the amount of data are quite large. The MPEG Layer III decoding algorithm verifies and passes the AT89C51SND1C and obtains better results. After optimization, the music can be played smoothly. This MP3 player system has both the function of playing songs and the function of U disk. The conversion of the two functions is controlled by the USB interface detection circuit: when the USB device on the MP3 player is inserted into the USB interface on the PC for file downloading, the U disk function is executed; otherwise, the program executes the MP3 function.

Machine Operation Panel

Machine Operation Panel

Feyvan CNC operation panel has a variety of designs for our customers to choose including unique European style design, acrylic button material, transparent crystal button, waterproof, oil proof, long service life, etc. Main panel characteristics as below:

- Supporting FANUC, MITSUBISHI and SIEMENS system.

- Supporting online debugging, easy error correction.

- Providing standard interface scheme and example procedures, easy to replacement and upgrading.

- Special design that can`t substitute between different factories.

- Band switch with G point check that will not appear unrecognizable code in the screen during turning.


Machine Operation Panel,Control Panel,Cnc Electrical Panel,Smart Panel

Feyvan Electronics Technology Co., Ltd. , https://www.fv-cable-assembly.com