ISD4004應用電路圖:
?
ISD4004電壓是3.3V,所以本把5V的電壓串聯了兩個二極管,這樣得到的電壓會是3.6伏左右,已經符合ISD4004的供電電壓,這個圖已經是很簡化的一個圖了,錄音輸入只采用負端單端輸入方式,本人已經試過可以用。
信號放大和功率放大電路:
?
運放采用典型的運放芯片NE5532,對ISD4004信號進行跟隨和放大,為后級功放提供了保障。
ISD4004驅動程序如下:
個人親自測試并應用過,此程序肯定可以用。
#include
#include
#define uchar unsigned char
#define uint unsigned int
// ISD4004 Control bit
#define SS_1 (PORTB |= BIT(0))
#define SS_0 (PORTB &= ~BIT(0))
#define SCLK_1 (PORTB |= BIT(1))
#define SCLK_0 (PORTB &= ~BIT(1))
#define MOSI_1 (PORTB |= BIT(2))
#define MOSI_0 (PORTB &= ~BIT(2))
#define MISO_1 (PORTB |= BIT(3))
#define MISO_0 (PORTB &= ~BIT(3))
uchar temp,flag;
void delay_ms(uint i)
{
uint a,k;
for(a=0;a
void Send_Data(uint ISD4004Data)
{
uchar i;
for(i=0;i> i;
temp= temp & 0x01;
if(temp) {MOSI_1;}
else {MOSI_0;}
SCLK_0;
SCLK_1;
MOSI_0;
}
}
void PowerUp(void)
{
SS_0;
Send_Data(0x20);
SS_1;
}
void Stop(void)
{
SS_0; //先把SS拉低
Send_Data( 0x10);
SS_1; //把SS拉高,
}
void Record(uint RecAddr)
{
PowerUp();
delay_ms(50);
PowerUp();
delay_ms(100);
SS_0;
Send_Data((uchar)RecAddr);
Send_Data((uchar)(RecAddr>>8));
Send_Data(0xA0);
SS_1;
SS_0;
Send_Data(0xB0);
SS_1;
}
void Play(uint Address)
{
PowerUp();
delay_ms(50);
SS_0;
Send_Data((uchar)Address);
Send_Data((uchar)(Address>>8));
Send_Data( 0xE0);
SS_1;
SS_0;
Send_Data(0xF0);
SS_1;
}
//*************************單片機端口初始化***************************
void port_init()
{
DDRA = 0xFF;
PORTA = 0x00;
DDRB = 0xFF;
PORTB = 0xFF;
DDRC = 0x00;
PORTC = 0xFF;
PINC = 0xff;
DDRD = 0x00;
PORTD = 0xff;
}
////////////////////////
void main()
{
port_init();
while(1)
{
if(!(PIND&0x10)&&(flag==0))
{
delay_ms(5);
if(!(PIND&0x10)&&(flag==0))
{
flag = 1;
//Record(0x600);
while(!(PIND&0x10));
}
}
if(!(PIND&0x10)&&(flag == 1))
{
delay_ms(5);
if(!(PIND&0x10)&&(flag == 1))
{
flag=2;
Stop();
while(!(PIND&0x10));
}
}
if(!(PIND&0x10)&&(flag == 2))
{
delay_ms(5);
if(!(PIND&0x10)&&(flag == 2))
{
flag=0;
Play(0x600);
while(!(PIND&0x10));
}
}
}
}
?
評論
查看更多