📄 apr9600.c
字号:
/********************************************
APR9600录放音程序
********************************************/
/*
sbit RE = P1^4 ;
sbit CE1 = P1^5 ;
sbit MSEL2 = P3^6 ;
sbit MSEL1 = P3^7 ;
sbit M1 = P2^0 ;
sbit M2 = P2^1 ;
sbit M3 = P2^2 ;
sbit M4 = P2^3 ;
sbit M5 = P2^4 ;
sbit M6 = P2^5 ;
sbit M7 = P2^6 ;
sbit M8 = P2^7 ;
*/
//uchar idata olddata ;
/********************************************
name : void play_switch(uchar in)
descrip : select play or rec
input : in: 1 play 0 rec
output : null
********************************************//*
void play_switch(uchar in)
{
if(in>1) return ;
RE = in ;
}
*/
/********************************************
name : void select_mode(uchar in1,uchar in2,uchar in3)
descrip : select mode
input : in1: 0-1 MESL1;in2:0-1 MESL2;in3:0-1 M8
output : null
********************************************//*
void select_mode(uchar in1,uchar in2,uchar in3)
{
MSEL1 = in1 ;
MSEL2 = in2 ;
M8 = in3 ;
}
*/
/********************************************
name : void play_record(uchar in1,uchar in2)
descrip : play or record n segment
input : in1: 1-8 segment ;
in2: 0-1 play or record
output : null
********************************************//*
void play_record(uchar in1,uchar in2)
{
if(in2 == 0) //play
{
P2 = 0xff & ~(1<<(in1-1)) ;
delay(110) ;
P2 = 0xff ;
}
else if(in2 == 1) //record
{
if(in1 != olddata)
{
olddata = in1 ;
P2 = 0xff & ~(1<<(in1-1)) ;
}
else
{
P2 = 0xff ;
olddata = 0 ;
}
}
else return ;
}*/
/********************************************
name : void stop_playrecord(void)
descrip : stop play or record
input : null
output : null
********************************************/
void stop_playrecord(uchar in)
{
CE1 = 1 ;
if(in == 0)
delay(130) ;
else
delay(200) ;
CE1 = 0 ;
// olddata = 0 ;
}
/********************************************
********以下是串行模式控制方式***************
********************************************/
/********************************************
name : void record_tape(uchar in1)
descrip : record program
input : in1 :start record or stop record
0: start record 1: stop record
output : null
********************************************//*
void record_tape(uchar in1)
{
// select_mode(0,0,1) ;
M8 = 1 ;
// delay(10) ;
M1 = in1 ;
}*/
/********************************************
name : void play_tape_switch(uchar in1)
descrip : play or mc play program
input : in1 1:select M1 2:select M2
output : null
********************************************//*
void play_tape_switch(uchar in1)
{
if(in1 == 1)
{
M1 = 0 ;
delay(110) ;
M1 = 1 ;
}
else if(in1 == 2)
{
M2 = 0 ;
delay(110) ;
M2 = 1 ;
}
}
*/
void Stop_Play()
{
CLRB(M1) ;
// M1 = 0 ;
delay(150) ;
SETB(M1) ;
// M1 = 1 ;
}
/********************************************
name : void play_tape(uchar in1)
descrip : play program
input : in1 :play n segment
1 -> n
output : null
********************************************/
void play_tape1(uchar in1)
{
uchar i,j ;
uchar flag ;
if(in1 == 0) return ;
if(Checked_playend_flag == 1)
{
Stop_Play() ; //stop play
delay(500) ;
}
if(in1 == Play_Id)
{
Stop_Play() ; //play
}
else if(in1<Play_Id)
{
stop_playrecord(0) ;
delay(100) ;
for(i=(in1-1);i>0;i--)
{
CLRB(M2) ;
// M2 = 0 ;
for(flag=0;flag<100;flag++)
{
delay(10) ;
if(BUSY==0) break ;
}
SETB(M2) ;
// M2 = 1 ;
delay(80) ;
while(BUSY==0) ;
delay(150) ;
}
delay(80) ;
Stop_Play() ; //play
}
else
{
j = in1-Play_Id ;
for(i=j;i>0;i--)
{
CLRB(M2) ;
// M2 = 0 ;
for(flag=0;flag<100;flag++)
{
delay(10) ;
if(BUSY==0) break ;
}
SETB(M2) ;
// M2 = 1 ;
delay(80) ;
while(BUSY==0) ;
delay(150) ;
}
delay(80) ;
Stop_Play() ; //play
}
Play_Id = in1 ;
Checked_playend_flag = 1 ;
delay(500) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -