The design of a digital music box based on a microcontroller is a project that utilizes the AT89C51 chip and an LCD display as its core components, along with necessary circuits, to create a single-chip electronic digital music box. The project aims to generate square waves of a certain frequency using the I/O port to drive a buzzer, produce different tones, and display information on an LCD screen to play music (at least three songs, each lasting at least 30 seconds). The system includes an English welcome message upon startup, displays the song number (or name) during playback, and allows for song selection, pause, and play functions using function keys.
The design incorporates a 4x4 keypad, uses Protel99 for drawing the hardware system diagram, employs assembly language for programming, compiles the code using KEIL C51, loads the generated HEX file into the chip, simulates the system using Proteus software, and verifies that all functions operate normally. The music box design allows users to select different tracks, play and pause songs, and display the song number and playback time on the LCD screen.
The keypad in this design utilizes a dynamic scanning method. Each time a row of keys is scanned, a low level signal is sent to that row, the input port status is read, and the presence of a pressed key is determined. If a key is pressed, the display value is selected based on the input port value and sent to the display value register. The key value is then determined, the T0 counter is started, the offset address for the selected music code is found, and the code generates pulses of a certain frequency to drive the buzzer and produce sound. At the same time, the T1 timer is started to calculate the playback time of the music.
Keywords: digital music box, AT89C51, LCD display, Proteus software, 4x4 keypad, dynamic scanning, KEIL C51.