首页 isd系列语音控制芯片代码实例

isd系列语音控制芯片代码实例

举报
开通vip

isd系列语音控制芯片代码实例isd系列语音控制芯片代码实例 //ISD4004 DRIVER #include"mcu-define.h" #include"delay.h" #include"isd4004.h" sbit ISD4XXX_SCLK=P3^6; sbit ISD4XXX_MISO =P3^4; sbit ISD4XXX_MOSI =P3^5; sbit ISD4XXX_SS =P3^7; //ISD4004 命令码 /* 指令 8位控制码,16位地址码 操作摘 要 POWERUP 00100xxx(xxx...

isd系列语音控制芯片代码实例
isd系列语音控制芯片代码实例 //ISD4004 DRIVER #include"mcu-define.h" #include"delay.h" #include"isd4004.h" sbit ISD4XXX_SCLK=P3^6; sbit ISD4XXX_MISO =P3^4; sbit ISD4XXX_MOSI =P3^5; sbit ISD4XXX_SS =P3^7; //ISD4004 命令码 /* 指令 8位控制码,16位地址码 操作摘 要 POWERUP 00100xxx(xxxxxxxxxxxxxxxx) 上电:等待TPUD后器件可以 工作 SET PLAY 11100xxx(A15~A0) 从指令地址开始放音,须后 跟PLAY指令,使放音继续 PLAY 11110xxx(xxxxxxxxxxxxxxx) 从当前地址开始放音(直至 EOM或OVF) SET REC 10110xxx(A15~A0) 从指定地址开始录 音,须后跟REC指令,使录音继续 REC 110110(xxxxxxxxxxxxxxx) 从当前地址开始录 音(直至OVF或停止) SET MC 11101xxx(A15~A0) 从指定地址开始快 进,须后跟MC指令,使快进继续 MC 11111xxx(xxxxxxxxxxxxxxx) 执行快进,直到 EOM,若再无信息,则进入OVF状态 STOP 0x110xxx(xxxxxxxxxxxxxxx) 停止当前操作 STOP PWRDN 0X01Xxxx(xxxxxxxxxxxxxxx) 停止当前的操作并掉电 RINT 0X110xxx(xxxxxxxxxxxxxxxx) 读状态;OVF和EOM */ #define ISD4XXX_POWER_UP 0x20 #define ISD4XXX_SET_PLAY 0xe0 #define ISD4XXX_PLAY 0xf0 #define ISD4XXX_SET_REC 0xb0 #define ISD4XXX_REC 0xd8 #define ISD4XXX_SET_MC 0xe8 #define ISD4XXX_MC 0xf8 #define ISD4XXX_STOP 0x30 #define ISD4XXX_STOP_PWRDN 0x10 #define ISD4XXX_RINT 0x30 unsigned char isd_spi(ISD_COMMAND * isdcommand) { unsigned char i; unsigned long miso; unsigned long mosi=(unsigned long *)isdcommand; ISD4XXX_MISO=1; ISD4XXX_SCLK=0; ISD4XXX_SS=0; miso=0; for (i=0;i<24;i++) { miso<<=1; miso |=(unsigned long )ISD4XXX_MISO; if (mosi & 0x800000 ==0x1) ISD4XXX_MOSI =1; else ISD4XXX_MOSI = 0; ISD4XXX_SCLK=1; mosi <<= 1; ISD4XXX_SCLK=0; } ISD4XXX_SCLK=1; return (char *)(miso+1); } void ISD4XXX_Record(unsigned int address) { // 1. power up // 2. TPUD(25ms) *2; // 3. power up; // 4. set record address = 00; // 5. rec command . ISD_COMMAND isd_command; isd_command.command_code=ISD4XXX_POWER_UP; // isd_command.int_address=0; isd_spi(&isd_command); soft_delay_10ms(3); soft_delay_10ms(3); isd_spi(&isd_command); isd_command.command_code=ISD4XXX_SET_REC; isd_command.int_address=address; isd_spi(&isd_command); isd_command.command_code=ISD4XXX_REC ; // isd_command.int_address=0; isd_spi(&isd_command); } void ISD4XXX_Play(unsigned int address) { // 1. POWER UP // 2. Delay tpuid. // 3. SET PLAY WITH ADDRESS 0; // 4. SEND play command. ISD_COMMAND isd_command; isd_command.command_code=ISD4XXX_POWER_UP; // isd_command.int_address=0; isd_spi(&isd_command); soft_delay_10ms(3); isd_command.command_code=ISD4XXX_SET_PLAY; isd_command.int_address=address; isd_spi(&isd_command); isd_command.command_code=ISD4XXX_PLAY; // isd_command.int_address=0; isd_spi(&isd_command); } void ISD4XXX_Stop(void) { ISD_COMMAND isd_command; isd_command.command_code=ISD4XXX_STOP; isd_spi(&isd_command); } void ISD4XXX_PowerOff(void) { ISD_COMMAND isd_command; isd_command.command_code=0x08; isd_spi(&isd_command); } void ISD4XXX_PowerOn(void) { ISD_COMMAND isd_command; isd_command.command_code=0x04; isd_spi(&isd_command); } static code unsigned int address_tab[22]= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }; void PlaySound(unsigned char index) { ISD4XXX_Play(address_tab[index]); } //end of file
本文档为【isd系列语音控制芯片代码实例】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_153723
暂无简介~
格式:doc
大小:19KB
软件:Word
页数:0
分类:
上传时间:2017-09-30
浏览量:20