⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 g.c

📁 isd2560的驱动
💻 C
字号:
 #include<at89x52.h>
#include<intrins.h>
//#define ovf P3_6
#define cs P3_5 	//片选
#define pd P3_4		//功耗选择
#define oem P3_3	//放音时的一端结束标志,低有效
#define pr P3_2		//高时为放音,低时为录音

#define a8 P2_5		 //为十条地址线 
#define a9 P2_6
#define date P1

#define uchar unsigned char 
#define uint unsigned int 




/**********************************************
                   放音程序
***********************************************/
void play(uint a)
{uchar b,b8=0,b9=0;
b=(a&0xff);
if(a&0x100) b8=1;
if(a&0x200) b9=1;

cs=1;
pd=0;
date=b;
a8=b8;
a9=b9;
pr=1;_nop_();_nop_();_nop_();
cs=0;
while(oem==1);
cs=1;
pd=1;_nop_();_nop_();_nop_();

}





/************************************************************
                     录音程序
 **********************************************************/
void record(uint a,uchar c)
{ uchar b,b8=0,b9=0;
b=(a&0xff);
if(a&0x100) b8=1;
if(a&0x200) b9=1;

cs=1;
pd=0;
date=b;
a8=b8;
a9=b9;
pr=0;_nop_();_nop_();_nop_();
cs=0;
if(c==4) while(P0_4==0);
if(c==5) while(P0_5==0);
if(c==6) while(P0_6==0);
if(c==7) while(P0_7==0);
cs=1;
pd=1;_nop_();_nop_();_nop_();
}








/*****************************************************************************
                            录音主程序
ISD2560内部存储器共分600段地址,每一段对应0.1秒,故总共60秒,随便你分几段来用;
该段程序的用法:当按下某段的录音键时开始录音,当放开该键时录音结束,按一下该段
                的放音键,可听听录音效果,不过该段录音时间要把握,以免覆盖到下
				段地址去
*******************************************************************************/
void judge()
{ while(1)
{ 
  P0_0=0;							//开始键盘键盘扫描,第一行为录音键
  if(P0_4==0){record(384,4);}		//record()函数中键入录音段的地址,为0至599,而其中的4,5,6,7不用管 
  if(P0_5==0) {record(416,5);}
  if(P0_6==0) {record(448,6);}
  if(P0_7==0) {record(480,7);}
  P0_0=1;

  P0_1=0;							   
  if(P0_4==0) {play(384);}			//第二段为上段对应地址的放音 键
  if(P0_5==0) {play(416);}
  if(P0_6==0) {play(448);}
  if(P0_7==0) {play(480);}
  P0_1=1;

  P0_2=0;
  if(P0_4==0){record(512,4);}
  if(P0_5==0) {record(544,5);}
  if(P0_6==0) {record(576,6);}
  if(P0_7==0) {record(599,7);}
  P0_2=1;

  P0_3=0;
  if(P0_4==0) {play(512);}
  if(P0_5==0) {play(544);}
  if(P0_6==0) {play(576);}
  if(P0_7==0) {play(224);}
  P0_3=1;

}

}






/*******************************************
                  全部录音试听
**********************************************/
void delay(uint a)
{while(a--);}

void read ()
{ while(1)
{play(0);
delay(40000);
play(32);
delay(40000);
play(64);
delay(40000);
play(96);
delay(40000);
play(128);
delay(40000);
play(160);
delay(40000);
play(192);
delay(40000);
play(224);
delay(40000);
play(256);
delay(40000);
play(288);
delay(40000);
play(320);
delay(40000);
play(352);
delay(40000);
play(384);
delay(40000);
play(416);
delay(40000);
play(448);
delay(40000);
play(480);
delay(40000);
play(512);
delay(40000);
play(544);
delay(40000);
play(576);
delay(40000);
}

}








void main()
{//judge();
read();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -