标题:
单片机的isd4004录放机制作程序
[打印本页]
作者:
xcv12346
时间:
2018-12-3 15:26
标题:
单片机的isd4004录放机制作程序
单片机源程序如下:
#include<reg52.h>
#include<intrins.h>
#include<LCD1602.h>
sbit SS=P1^0;
sbit MOSI=P1^1;
sbit SCLK=P1^2;
sbit INT=P1^3;
sbit Rec=P1^4;
sbit Play=P1^5;
sbit Stop=P1^6;
sbit Shut=P1^7;
sbit RecLight=p2^5;
sbit PlayLight=p2^6;
sbit WorkLight=P2^7;
unsigned int n;
unsigned char count;
unsigned char code
POWERUP=0x20,SETPLAY=0xE0,PLAY=0xF0,SETREC=0xA0,REC=0xB0,SETMC=0xE8,MC=0xF8,STOP=0x30,STOPPOWER=0x10;
unsigned char code speed[]={"speed:"};
unsigned char code tab[]={"0123456789"};
void dingshiqi() interrupt 1
{
TH0=0x4c;
TL0=0x00;
n++;
}
void display()
{
unsigned char i,count_ge,count_shi,count_bai;
count=TH1*0X10*0X10+TL1;
count_ge=(unsigned char)(count%10);
count_shi=(unsigned char)((count%100)/10);
count_bai=(unsigned char)(count/100);
write_com(0x80);
for(i=0;i<6;i++)
{
write_dat(speed[i]);
}
write_dat(tab[count_bai]);
write_dat(tab[count_shi]);
wirte_dat(tab[count_ge]);
write_dat('r');
TH1=0;
TL1=0;
n=0;
}
void delay(unsigned int i)
{
while(i--);
}
void Command(unsigned char command,unsigned int address)
{
unsigned char i,j;
SS=1;
SCLK=0;
SS=0;
if(address!=0)
{
SS=1;
SCLK=0;
SS=0;
for(i=0;i<16;i++)
{
address=_cror_(address,1);
j=address<<1;
MOSI=CY;
SCLK=0;
delay(3);
SCLK=1;
}
}
for(i=0;i<8,i++)
{
command=_cror_(command,1);
j=command<<1;
MOSI=CY;
SCLK=0;
delay(3);
SCLK=1;
}
SS=1;
}
void main()
{
unsigned char a=1:
P1=0xFF;
P0=0xFF;
INT=1;
lcd_init();
EA=1;
ET0=1;
ET1=1;
TMOD=0x51;
TH1=0;
TL1=0;
TH0=0x4c;
TL0=0x00;
TR0=1;
TR1=1;
while(1)
{
while(Rec==0)
{
delay(3000);
while (Rec==0)
{
RecLight=0;
PlayLight=1;
WorkLight=0;
Command(POWERUP,0);
delay(6000);
Command(POWERUP,0);
delay(6000);
delay(6000);
Command(SETREC,0x05);
Command(REC,0);
break;
}
while (Rec==0){};
}
while(Play==0)
{
delay(3000);
while(Play==0)
{
PlayLight=0;
RecLight=1;
WorkLight=0;
Command(POWERUP,0);
delay(6000);
Command(POWERUP,0);
delay(6000);
delay(6000);
Command(SETPLAY,0x05);
Command(PLAY,0);
break;
}
while(Play==0){};
}
while{Stop==0||INT==0)
{
delay(3000);
while(Stop==0||INT==0)
{
PlayLight=1;
RecLight=1;
Command(Stop,0);
a=1;
break;
}
while (Stop==0){};
}
while{Shut==0}
{
delay(3000);
while (Shut==0)
{
PlayLight=1;
RecLight=1;
WorkLight=1;
Command(STOPPOWER,0)
break;
}
while(Shut==0){};
}
if(n==20) display();
if(count>40&&a==1)
{
PlayLight=0;
RecLight=1;
WorkLight=0;
Command(POWERUP,0)
delay(6000);
Command(POWERUP,0)
delay(6000);
delay(6000);
Command(SETPLAY,0x05);
Command(PLAY,0);
a=0;
}
}
}
复制代码
所有资料51hei提供下载:
dpj.rar
(6.17 KB, 下载次数: 12)
2018-12-3 15:26 上传
点击文件名下载附件
下载积分: 黑币 -5
作者:
admin
时间:
2018-12-4 04:27
补全原理图或者详细说明一下电路连接即可获得100+黑币
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1