📄 isd1420.h
字号:
//==========================================================
//作 者: 雨枭风
//联系QQ:401386501
//您下载的资料属于电子前沿原创,转载请注明出处
//关于此程序您有任何问题可到http://www.e-fad.com.cn/留言
//==========================================================
#ifndef _isd1420_
#define _isd1420_
#include "lcd1602.h"
#include "commmon.h"
bit if_out(bit out)
{ bit outt=out;
if(!SET_MODE)delay_LCM(10);
if(!SET_MODE)
{
while(!SET_MODE)delay_LCM(10);
outt=~outt;
}
return(outt);
}
void rec_one(unsigned char rec_key)
{ unsigned char rec_number;
rec_number=rec_key;
ISD1420_REC=1;
switch(rec_number)
{
case 1: DisplayListChar(0,0,setting1); //1
DisplayListChar(0,1,setting); //空白
ISD1420PORT=0x00;
ISD1420_REC=0;
delay0(18000); //北京时间
ISD1420_REC=1; //STOP rec
DisplayListChar(0,1,setting0);break;
case 2: DisplayListChar(0,0,setting2);
DisplayListChar(0,1,setting);
ISD1420PORT=0x10;
ISD1420_REC=0;
delay0(9000); //年
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 3: DisplayListChar(0,0,setting3);
DisplayListChar(0,1,setting);
ISD1420PORT=0x18;
ISD1420_REC=0;
delay0(9000);
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 4: DisplayListChar(0,0,setting4);
DisplayListChar(0,1,setting);
ISD1420PORT=0x20;
ISD1420_REC=0;
delay0(9000);
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 5: DisplayListChar(0,0,setting5);
DisplayListChar(0,1,setting);
ISD1420PORT=0x28;
ISD1420_REC=0;
delay0(9000); //点
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 6: DisplayListChar(0,0,setting6);
DisplayListChar(0,1,setting);
ISD1420PORT=0x30;
ISD1420_REC=0;
delay0(9000); //分
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 7: DisplayListChar(0,0,setting7);
DisplayListChar(0,1,setting);
ISD1420PORT=0x38;
ISD1420_REC=0;
delay0(9000); //0
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 8: DisplayListChar(0,0,setting8);
DisplayListChar(0,1,setting);
ISD1420PORT=0x40;
ISD1420_REC=0;
delay0(9000); //1
ISD1420_REC=1;DisplayListChar(0,1,setting0);break;
case 9: DisplayListChar(0,0,setting9);
DisplayListChar(0,1,setting);
ISD1420PORT=0x48;
ISD1420_REC=0;
delay0(9000); //2
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 10:DisplayListChar(0,0,setting10);
DisplayListChar(0,1,setting);
ISD1420PORT=0x50;
ISD1420_REC=0;
delay0(9000); //3
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 11:DisplayListChar(0,0,setting11);
DisplayListChar(0,1,setting);
ISD1420PORT=0x58;
ISD1420_REC=0;
delay0(9000); //4
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 12:DisplayListChar(0,0,setting12);
DisplayListChar(0,1,setting);
ISD1420PORT=0x60;ISD1420_REC=0;delay0(9000); //5
ISD1420_REC=1;
DisplayListChar(0,1,setting0);break;
case 13:DisplayListChar(0,0,setting13);DisplayListChar(0,1,setting);ISD1420PORT=0x68;
ISD1420_REC=0;
delay0(9000); //6
ISD1420_REC=1;DisplayListChar(0,1,setting0);break;
case 14:DisplayListChar(0,0,setting14);DisplayListChar(0,1,setting);ISD1420PORT=0x70;
ISD1420_REC=0;
delay0(9000); //7
ISD1420_REC=1;DisplayListChar(0,1,setting0);break;
case 15:DisplayListChar(0,0,setting15);DisplayListChar(0,1,setting);ISD1420PORT=0x78;
ISD1420_REC=0;
delay0(9000); //8
ISD1420_REC=1;DisplayListChar(0,1,setting0);break;
case 16:DisplayListChar(0,0,setting16);DisplayListChar(0,1,setting);ISD1420PORT=0x80;
ISD1420_REC=0;
delay0(9000); //9
ISD1420_REC=1;DisplayListChar(0,1,setting0);break;
case 17:DisplayListChar(0,0,setting17);DisplayListChar(0,1,setting);ISD1420PORT=0x88;
ISD1420_REC=0;
delay0(9000); //十
ISD1420_REC=1;DisplayListChar(0,1,setting0);break;
case 18:DisplayListChar(0,0,setting18);DisplayListChar(0,1,setting);ISD1420PORT=0x98;
ISD1420_REC=0;
delay0(9000); //十
ISD1420_REC=1;DisplayListChar(0,1,setting0);break;
default:break;
}
}
void Rec(void)
{
unsigned char si=0;
unsigned char si_first=0;
unsigned char out=1;
WriteCommandLCM(0x0c,1);
DisplayListChar(0,0,str2);
DisplayListChar(0,1,str8);
while(out)
{ si_first=si;
if(!SET_DISP)delay_LCM(10);
if(!SET_DISP){while(!SET_DISP)delay_LCM(10);si++;if(si>18)si=1;}
if(si!=si_first)
{
rec_one(si);
out=if_out(out);
}
else
out=if_out(out);
}
}
void Report(bit t)
{ bit j=t;
uchar shi,fen;
shi=Read1302(hou|read);
fen=Read1302(min|read);
PLAY=1;
if(j) //闹钟报时
{ ISD1420PORT=yuyiny[0];PLAY=0;delay0(20000); PLAY=1; // 放音"北京时间"
//报小时开始 10ms
if(shi/16<1) //00--09点
{ISD1420PORT=yuyiny[shi%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
if(shi/16==1)
{if(shi==0x10) //10 点
{ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000); PLAY=1; //11--19 点
ISD1420PORT=yuyiny[shi%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
}
if(shi/16==2)
{if(shi==0x20) //20 点
{ISD1420PORT=yuyiny[8];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{ISD1420PORT=yuyiny[8];PLAY=0;delay0(11000);display(); PLAY=1; //21--23
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[shi%16+6];PLAY=0;delay0(11000);display();PLAY=1;}
}
ISD1420PORT=yuyiny[4];PLAY=0;delay0(11000);display(); PLAY=1; // 放音"点"
//报分数开始
if(fen/16<1) //00--09分
{ISD1420PORT=yuyiny[fen%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
if(fen/16==1)
{if(fen==0x10) //10 分
{ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1; //11--19 分
ISD1420PORT=yuyiny[fen%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
}
if(fen/16==2)
{if(fen==0x20) //20 分
{ISD1420PORT=yuyiny[8];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{ISD1420PORT=yuyiny[8];PLAY=0;delay0(11000); display();PLAY=1; //21--29
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[fen%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
}
if(fen/16==3)
{if(fen==0x30) //30 分
{ISD1420PORT=yuyiny[9];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{ISD1420PORT=yuyiny[9];PLAY=0;delay0(11000);display(); PLAY=1; //31--39
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[fen%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
}
if(fen/16==4)
{if(fen==0x40) //40 分
{ISD1420PORT=yuyiny[10];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{ISD1420PORT=yuyiny[10];PLAY=0;delay0(11000);display(); PLAY=1; //41--49
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[fen%16+6];PLAY=0;delay0(11000);display();PLAY=1;}
}
if(fen/16==5)
{if(fen==0x20) //50 分
{ISD1420PORT=yuyiny[11];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{ISD1420PORT=yuyiny[11];PLAY=0;delay0(11000);display(); PLAY=1; //51--59
ISD1420PORT=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;
ISD1420PORT=yuyiny[fen%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
}
ISD1420PORT=yuyiny[5];PLAY=0;delay0(11000);display(); PLAY=1; // 放音"分"
}
//整点报时
else
{//闹钟报时
P2=yuyiny[0];PLAY=0;delay0(20000);display(); PLAY=1; // 放音"北京时间"
if(shi/16<1) //00--09点
{P2=yuyiny[shi%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
if(shi/16==1)
{if(shi==0x10) //10 点
{P2=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{P2=yuyiny[16];PLAY=0;delay0(11000);display(); PLAY=1; //11--19 点
P2=yuyiny[shi%16+6];PLAY=0;delay0(11000);display(); PLAY=1;}
}
if(shi/16==2)
{if(shi==0x20) //20 点
{P2=yuyiny[8];PLAY=0;delay0(11000);display();PLAY=1;
P2=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;}
else{P2=yuyiny[8];PLAY=0;delay0(11000);display(); PLAY=1; //21--23
P2=yuyiny[16];PLAY=0;delay0(11000);display();PLAY=1;
P2=yuyiny[shi%16+6];PLAY=0;delay0(11000);display();PLAY=1;}
}
P2=yuyiny[4];PLAY=0;delay0(11000);display(); PLAY=1; // 放音"点"
P2=yuyiny[17];PLAY=0;delay0(11000);display(); PLAY=1; // 放音"整"
}
}
playvoice() //放音程序
{
if(Read1302(0xc3)==0x54) //报整点
{
if(Read1302(min|read)==0x00)Report(0); //报一分种
}
if(Read1302(0xc1)==0x54) //报闹钟
{if(Read1302(hou|read)==Read1302(clock_hour|read))
if(Read1302(min|read)==Read1302(clock_min|read))
{Report(1);}
if(Read1302(min|read)==Read1302(clock_min|read)+1) //为了报一分种
if(Read1302(clock_key|read)==0x4F)//4f是O
if(Read1302(min|read)==Read1302(clock_min|read)+1)
{Write1302(0x8e,0x00);//允许写操作
Write1302(0xc0,0x46); // t=>f
Write1302(0x8e,0x80);
}
}
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -