摘要
针对51单片机I/O定时翻转电平驱动蜂鸣器方法存在的缺点,以PIC单片机为核心控制元件,利用内部PWM硬件资源,实现了简易音乐播放系统设计。通过改变PWM端口输出脉冲信号频率及脉宽,驱动蜂呜器发出不同音调,并结合单片机内部定时器中断控制音调高低及节拍长度,此外可通过4×4矩阵键盘实现简单音乐弹奏。实验结果表明,该系统硬件电路简单,软件占用CPU时间少,易控制音乐音调及节拍,音色纯正,具有一定的实用与参考价值。
A simple music playing system based on the PWM mode of PIC microcontroller is designed to replace the method which using 51 microcontroller I/O timing logic high-low level reversal to drive buzzer. The system can give forth vary tones by changing frequency and pulse width of the PWM signal, the inflection and duration of the tone is controlled by the timer interrupt of microcontroller, and the system can play various music by typing the 4 ×4 matrix keyboard. Experimental results show that the system hardware circuit is simple, software occupies less CPU time, the tone and duration of the music can be controlled easily, moreover, it sounds pure. The system has some practical and reference value.
出处
《测控技术》
CSCD
北大核心
2014年第9期72-75,共4页
Measurement & Control Technology