这是别人的程序,可以通过,希望对你有帮助。#include #define uchar unsigned char#define uint unsigned intsbit PR=P2^5;sbit PE=P2^4;sbit key=P3^0;//延时程序void delay10ms(uint time){ uint i,j; for(i=0;i for(j=0;j<1820;j++);}void Voice(uchar k,uint t_ms,bit REC) // 发声程序,地址,时间,录放{ P2&=0xf0; P2|=k; if(REC) //如果是录音则REC=1 { PR=0; PE=0; } else { PR=1; PE=0; } delay10ms(t_ms); PE=1; PR=1;}void Record(){ while(key); Voice(0,100,1); //录音:提示音 delay10ms(100); Voice(0,100,0); while(key); //录音:前进 Voice(1,100,1); delay10ms(100); Voice(1,100,0); while(key); //录音:后退 Voice(2,100,1); delay10ms(100); Voice(2,100,0); while(key); //录音:左转 Voice(3,100,1); delay10ms(100); Voice(3,100,0); while(key); //录音:右转 Voice(4,100,1); delay10ms(100); Voice(4,100,0); while(key); //录音:云台上升 Voice(5,150,1); delay10ms(100); Voice(5,150,0); while(key); //录音:云台下降 Voice(6,150,1); delay10ms(100); Voice(6,150,0); while(key); //录音:云台左转 Voice(7,150,1); delay10ms(100); Voice(7,150,0); while(key); //录音:云台右转 Voice(8,150,1); delay10ms(100); Voice(8,150,0); while(key); //短信已发出 Voice(9,150,1); delay10ms(100); Voice(9,150,0); while(key); //录音:停止 Voice(10,100,1); delay10ms(100); Voice(10,100,0);}void Play(){ while(key); //放音 Voice(0,100,0); delay10ms(100); Voice(1,100,0); delay10ms(100); Voice(2,100,0); delay10ms(100); Voice(3,100,0); delay10ms(100); Voice(4,100,0); delay10ms(100); Voice(5,150,0); delay10ms(100); Voice(6,150,0); delay10ms(100); Voice(7,150,0); delay10ms(100); Voice(8,150,0); delay10ms(100); Voice(9,150,0); delay10ms(100); Voice(10,100,0);}void main() //主程序{ while(1) { //Record(); Play(); }}