资源描述:
《ISD语音芯片SPI通讯协议.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、0x010x020x030x040x050x060x070x080x090x400x410x430x440x450x650x460x490x800x810x82〃上电〃复位〃清屮断//读状态〃掉电〃读取芯片ID〃播放〃录音〃读APC//SPI模式下写APC寄存〃永久写入寄存器〃检杏环状存储器〃设置播放#ifndef_SPIEX_#define_SPIEX_#include#include#include#defineucharunsignedch
2、ar#defineuintimsignedint//sbitledl=PlA7;//sbitled2=PlA6;//sbitled3=PlA5;sbitISD_SS=P2A7;/ISDI760的slaveselectsbitISD_SCLK=P2A6;//ISD1760的SPI接口时钟sbitISD_MOSI=P2A5;/ED1760的SPI接口数据输入端口sbitISD_MISO=P2A4;/ED1760的SPI接U的串行输出//sbitsbnINT_1760=P3A2;//BD1760的INT管脚〃
3、未使用〃外部中断可用此脚//sbitsbSRT_1760=P3人3;//BD1760的RESET管脚〃未使用//—-ISD1760SPI命令一…#define(MD_1760_PU#defineCMD_1760_STOP#defineCMD_1760_RESET#defineCMD_1760_CLI_INT#defineCMD_1760_RD_STATUS#defineCMD_1760_RD_PLAY_PTR#defineCMD_1760_PD#defineCMD_1760_RD_REC_PTR#def
4、ineCMD_1760_RD_DEVID#defineCMD_1760_PLAY#defineCMD_1760_REC#define(MD_1760_G_ERASE#defineCMD_1760_RD_APC#defineCMD_176O_WR_APC1#defineCMD_1760_WR_APC2器#defineCMD_1760_WR_NVCFG#defineCMD_1760_CHK_MEM#defineCMD_1760_SET_PLAY#defineCMD_1760_SET_REC#define(M
5、D_1760_SET_ERASEunsignedcharbdataSR0_L;sbitbINT=SR0_LA4;sbitbEOM=SRO_LA3;sbitbPU=SR0_LA2;sbitbFULL=SR()_LA1;sbitbCMD_ERR=SRO_LAO;unsignedcharbdataSRO_H;unsignedcharbdataSRI;sbitbREC=SRlA3;sbitbPLAY=SRlA2;sbitbERASE=SRlAl;sbitbRDY=SRlAO;unsignedcharID,APC
6、L=(),APCH=O;uintcodeaSpeech_Addr[32]={0x0010,0x001ef,0x001B,0x0025,0x0026,0x0030,0x0031,0x003B,0x003C,0x0046,//10x0047,0x(X)51,0x0052,OxOO5C,Ox()O5D,0x0067,0x0068,0x0072,0x0073,OxOO7D,//20x007E,0x0088,0x0089,0x0093,0x0094,0x009E,0x009F,0x00A9,0x00AA,0x00
7、B4y/3OxOOB5,OxO()C3};//voidDelayX1ms(uinta);//ISD1760ucharISD_SendByte(ucharBUF_ISD);voidISD_Reset(void);voidISD_PU(void);voidISD_Rd_Status(void);voidISD_ClrInt(void);voidISD_CHK_MEM(void);voidISD_WR_APC2(ucharVolume);voidISD_WR_NVCFG(void);voidISD_RDAPC
8、(void);voidISD_PD(void);ucharISD_RDDevID(void);voidISD_Init(void);voidISD_PLAY(void);/*#defineRIGHT1#defineERROR0//#defineSET_BIT(x,y)(xl=(l«y))//x的y位置1//#defineCLR_BIT(x,y)(x&二〜(lvvy))//清x的y位//#defineGET_BIT(x,y)(x&(l«y))