📄 isd1700c.1.txt
字号:
isd17系列的驱动程序,已经调试通过的,替换一停产的isd1420 isd2560 isd14系列 isd25系列的 最新芯片,音质性能比isd1420系列有明显提高。 有问题可以一起学习。
/**********************************************************************
*Copyright (c) 2007,
* 工程名称:
* 摘 要:
***********************************************************************
* qq 174825484 yesliuyu@yahoo.cn
*
* 完成日期:
//------------------------------------------------------------------
void delay(uint msec)
{
for (msec; msec > 0; msec--)
{
clrwatchdog();
delay_50us(20);
}
}
uchar spio(uchar BUF_ISD) //shaoliang
{
uchar i,dat=BUF_ISD;
SCLK=1;
SS=0;
for(i=0;i<8;i++)
{
SCLK=0;
_nop_(); _nop_();_nop_(); _nop_(); _nop_();
if(dat&amt;0X01) MOSI=1;
else MOSI=0;
dat>>=1;
if(MISO)
dat=(dat|0X80);
SCLK=1;
_nop_(); _nop_(); _nop_(); _nop_();_nop_();
}
MOSI=0;
return(dat);
}
void rdstatus()
{
spio(0x05);
spio(0x00);
spio(0x00);
SS=1;
//delay(100); //延迟100ms
SR0_L=spio(0x05);
SR0_H=spio(0x00);
SR1=spio(0x00);
}
void clrint()
{
spio(0x04); spio(0x00); SS=1;
}
pu() //power up
{
spio(0x01); spio(0x00); SS=1;
delay(120);
}
void pd() //power down
{
spio(0x07); spio(0x00); SS=1;
delay(100);
}
void reset()
{
spio(0x03); spio(0x00); SS=1;
delay(100);
}
void chk_mem()
{
spio(0x49); spio(0x00); SS=1; delay(150);
}
/*
void rd_apc()
{
spio(0x44);spio(0x00); spio(0x00);spio(0x00);
SS=1;
spio(0x44);spio(0x00); APCL=spio(0x00);APCH=spio(0x00);
}
void playall()
{
spio(0x40); spio(0x00); SS=1;
}
void wr_apc1() //线路输入,aud输出
{
spio(0x45); spio(0x00); spio(0x04); // d7:d0 d11:d8
SS=1; delay(1) ;
}
void rec()
{
spio(0x41); spio(0x00); SS=1;
}
void erase()
{
spio(0x42); spio(0x00); SS=1;
}
void eraseall()
{
spio(0x43); spio(0x00); SS=1;
}
void rd_play_ptr()
{
spio(0x06); spio(0x00); spio(0x00); spio(0x00);
SS=1;
}
void devid()
{
spio(0x09);spio(0x00);spio(0x00);
SS=1;
spio(0x09);spio(0x00);ID=spio(0x00);
}
senddata()
{
SBUF=SR0_L; while(TI==0); TI=0;
SBUF=SR0_H ; while(TI==0); TI=0;
SBUF=SR1; while(TI==0); TI=0;
}
*/
void stop()
{
spio(0x02);spio(0x00); SS=1;
}
setplay(uchar segment)
{
switch (segment)
{
case 1:
spio(0x80);spio(0x00); spio(0x10);spio(0x00);spio(0x2a);spio(0x00);SS=1;
break;
case 2:
spio(0x80);spio(0x00); spio(0x2B);spio(0x00);spio(0x41);spio(0x00);SS=1;
break;
case 3:
spio(0x80);spio(0x00); spio(0x42);spio(0x00);spio(0x4e);spio(0x00);SS=1;
break;
case 4:
spio(0x80);spio(0x00); spio(0x4F);spio(0x00);spio(0x62);spio(0x00);SS=1;
break;
case 5:
spio(0x80);spio(0x00); spio(0x63);spio(0x00);spio(0x70);spio(0x00);SS=1;
break;
case 6:
spio(0x80);spio(0x00); spio(0x71);spio(0x00);spio(0x80);spio(0x00);SS=1;
break;
case 7:
spio(0x80);spio(0x00); spio(0x81);spio(0x00);spio(0x9e);spio(0x00);SS=1;
break;
case 8:
spio(0x80);spio(0x00); spio(0x9F);spio(0x00);spio(0xaf);spio(0x00);SS=1;
break;
case 9:
spio(0x80);spio(0x00); spio(0xB0);spio(0x00);spio(0xBc);spio(0x00);SS=1;
break;
case 10:
spio(0x80);spio(0x00); spio(0xBD);spio(0x00);spio(0xCB);spio(0x00);SS=1;
break;
default:
spio(0x80);spio(0x00); spio(0x10);spio(0x00);spio(0x2a);spio(0x00);SS=1;
break;
}
}
initisd1700()
{
dd: pu(); //上电
if((PU_1700==0||CMD_ERR==1) &amt;&amt;ISDEvent!=10)
{
ISDEvent++;
reset();
pd();
goto dd;
}
ISDEvent=0;
}
/*
void isdmain()
{
uchar serial=0;
uint aa=0;
delay(1000);
TMOD=0x20;
TL1=0xfd;TH1=0xfd; //波特率9600 8数据 1停止
SCON=0xd8;PCON=0x00;
TR1=1;
P0=0xFF;P2=0xFF; MOSI=0;
LED1=0;
SBUF=0x55;while(TI==0); TI=0;
SBUF=0xAA;while(TI==0); TI=0;
dd: pu(); //上电
rdstatus();
senddata();
// SBUF=SR0_L; while(TI==0); TI=0; //////////////////
if(PU_1700==0||CMD_ERR==1)
{
reset();
pd();
SBUF=0xAB; while(TI==0); TI=0; //
goto dd;
}
clrint();
rdstatus();
senddata();
devid();
SBUF=0xDD; while(TI==0); TI=0; //////////////////
SBUF=ID; while(TI==0); TI=0;
// wr_apc1();
rd_apc();
SBUF=0xAC; while(TI==0); TI=0;
SBUF=APCH; while(TI==0); TI=0;
SBUF=APCL; while(TI==0); TI=0;
aa: setplay(1);
rdstatus();
senddata(); //////////////////
if(CMD_ERR==1)
{
clrint();
SBUF=0xBC; while(TI==0); TI=0;
goto aa;
}
while(1)
{
if(key3==0)delay(20);
{
if(key3==0)
{
clrint();
chk_mem();
while(key3==0)
{
rec();
rdstatus();
while(REC_1700)
{
delay(50);
LED1=!LED1;
SBUF=0xCD; while(TI==0); TI=0;
}
}
clrint();
stop();
//delay(50);LED1=!LED1;
}
}
if(key1==0) delay(20) ;
{
if(key1==0)
{
// stop();
cc: chk_mem();
playall();
clrint();
rdstatus();
senddata();
if(CMD_ERR)
{
SBUF=0xBC; while(TI==0); TI=0;
goto cc;
}
while(key1==0);
}
}
LED2=!LED2; delay(50);//SBUF=0x1a;while(TI==0); TI=0;
}
}
*/
<SCRIPT src="/inc/gg_read2.js"></SCRIPT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -