Simulation design based on single-chip computer notes and music electronic organ - complete course design materials

[Resource Download] The download address is as follows:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl

This design first carefully analyzes the simple electronic piano designed by the single-chip microcomputer, then makes the hardware circuit and writes the software program, and finally carries out the debugging and operation of the software and hardware. And from the schematic diagram, the main chip, the principle of each module and the program debugging of each module to explain. Use the single-chip microcomputer to generate different frequencies to obtain the scale we require, realize the pronunciation and display of 21 notes in total, high, middle and low, and control display during music playback, and can automatically play the music programmed in the program. The system runs stably, and its advantages are simple hardware circuit, perfect software function, reliable control system, high cost performance, etc. It has certain use and reference value.

With the rapid development of science and technology, the application of single-chip microcomputer is becoming more and more common. SCM has powerful control functions and flexible programming features, it has been integrated into the life of modern people and has become an irreplaceable part. The single-chip microcomputer system design applies the single-chip microcomputer control technology, using the AT89C51 single-chip microcomputer as the core control component to design a set of single-chip microcomputer-controlled electronic piano system based on the knowledge of the single-chip microcomputer learned this semester. The electronic organ is the product of the combination of modern electronic technology and music. It is a new type of keyboard instrument, which plays an important role in modern music.

【Keywords】AT89C51 2 digital tube independent button buzzer

#include<reg51.h>
#include<intrins.h>
typedef unsigned int  uint;   
typedef unsigned char uchar;
sbit SDA1=P0^2;//串行数据输入,对应595的14脚SER
sbit SCL1=P0^1;//移位寄存器时钟输入,对应595的11脚SCK
sbit SCL2=P0^0;//存储寄存器时钟输入,对应595的12脚RCK
sbit W1=P0^3;
sbit W2=P0^4;
sbit k1=P1^0;
sbit k2=P1^1;
sbit k3=P1^2;
sbit k4=P1^3;
sbit k5=P1^4;
sbit k6=P1^5;
sbit k7=P1^6;
sbit D1=P2^6;//播放音乐模式
sbit D2=P2^7;//弹奏模式 
sbit k8=P3^2;//功能切换键
sbit k9=P3^3;//低音
sbit k10=P3^4;//中音
sbit k11=P3^5;//高音
sbit beep=P2^2;//蜂鸣器接口
uchar code table1[]={   
						0x3F,/*0*/
						0x06,/*1*/
						0x5B,/*2*/
						0x4F,/*3*/
						0x66,/*4*/
						0x6D,/*5*/
						0x7D,/*6*/
						0x07,/*7*/
						0x7F,/*8*/
						0x6F,/*9*/
						0x37,/*N*///中音	
						0x38,/*L*///低音
						0x76,/*H*///高音
						0x79 /*E*/
					};//共阴极数码管
uchar code table2[]={		 
						0xFC,0xFC,0xFD,0xFD,0xFD,0xFD,0xFE,//中音
						0xF9,0xF9,0xFA,0xFA,0xFB,0xFB,0xFC,//低音的高8位
						0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFF,
                	};//音阶频率表 低八位
uchar code table3[]={		
						0x8E,0xED,0x44,0x6B,0xB4,0xF4,0x2D,//中音
						0x21,0xDB,0x87,0xD7,0x68,0xE8,0x5B,//低音的低8位
						0x47,0x77,0xA2,0xB6,0xDA,0xFA,0x16,
					};
uchar code table4[]={
						1,2,3,1,      
						1,2,3,1,      
						3,4,5,    
						3,4,5,     
						5,6,5,4,3,1,    

Guess you like

Origin blog.csdn.net/AuroraFaye/article/details/115052805