首 页文档资料下载资料维修视频包年699元
请登录  |  免费注册
当前位置:精通维修下载 > 文档资料 > 家电技术 > 单元电路介绍 > 其它电路
ISD4004应用电路及程序
来源:本站整理  作者:佚名  2011-08-11 19:01:04




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));
}
}
}
}

上一页  [1] [2] 

关键词:

文章评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分)
Copyright © 2007-2017 down.gzweix.Com. All Rights Reserved .
页面执行时间:27,453.13000 毫秒