#include "STC15.h"
//PC85,AT24C02,LED,SMG,3*4键盘
#include "sys.h"
#include "smg.h"
#include "key.h"
#include "iic.h"
#include "time.h"
#include "AT24C02.h"
uchar liangdu;extern uchar test;
extern uchar brightness;
uchar moshi3[4]={0x7e,0xbd,0xdb,0xe7};
uchar p0_value=0;
uchar change=0,time=4;
char moshi_led=1;
uchar temp=0,read_biaozhi=1,S7_biaozhi=1,dyci=0;
extern uchar smg_biaozhi;
void S6_cufa()
{
uchar o=0;
if(change==1)
{
if(smg_biaozhi==0)
{
smg_display(0,0,0);
smg_display(1,moshi_led,0);
smg_display(2,0,0);
}
else
{
smg_display(0,18,0);
smg_display(1,18,0);
smg_display(2,18,0);
}
smg_display(3,18,0);
if(time/10==0||time/10>12)smg_display(4,18,0);
else smg_display(4,time/10,0);
smg_display(5,time%10,0);
smg_display(6,0,0);
smg_display(7,0,0);
if(temp==5)
{
moshi_led++;if(moshi_led>=5)moshi_led=1;
}
if(temp==4)
{
moshi_led--;if(moshi_led<=0)moshi_led=4;
}
}
if(change==2)
{
if(smg_biaozhi==0)
{//40-120
smg_display(3,18,0);
if(time/10==0||time/10>12)smg_display(4,18,0);
else smg_display(4,time/10,0);
smg_display(5,time%10,0);
smg_display(6,0,0);
smg_display(7,0,0);
}
else
{
smg_display(3,18,0);
smg_display(4,18,0);
smg_display(5,18,0);
smg_display(6,18,0);
smg_display(7,18,0);
}
smg_display(0,0,0);
smg_display(1,moshi_led,0);
smg_display(2,0,0);
if(temp==5)
{
time++;if(time==13)time=0;
}
if(temp==4)
{
time--;if(time==0)time=12;
}
}
if(change==3)
{
AT24C02_Write(2,moshi_led);Delay1ms(10);
AT24C02_Write(1,time);Delay1ms(10);
for(o=0;o<8;o++)
{
smg_display(o,18,0);
}//smg_display(4,change,0);
read_biaozhi=1;
ET1=0;ET0=1;
}
if(change==3)change=0;
//smg_display(4,change,0);
}
void LED()
{
uchar i=0;
if(read_biaozhi==1&&S7_biaozhi==0&&dyci==1)
{
if(moshi_led==1)
{
for(i=0;i<8;i++)
{
temp = key_display();if(temp==7){S7_biaozhi=0;break;}
p0_value = ~(0x01<<i);
hc573(4);
Delay1ms(100);
}
}
if(moshi_led==2)
{
for(i=0;i<8;i++)
{
temp = key_display();if(temp==7){S7_biaozhi=0;break;}
p0_value = ~(0x01<<(7-i));
hc573(4);
Delay1ms(time*100);
}
}
if(moshi_led==3)
{
for(i=0;i<4;i++)//这个是反复
{
temp = key_display();if(temp==7){S7_biaozhi=0;break;}
p0_value = moshi3[i];
hc573(4);
Delay1ms(time*100);
}
}
if(moshi_led==4)
{
for(i=0;i<4;i++)//这个是反复
{
temp = key_display();if(temp==7){S7_biaozhi=0;break;}
p0_value = moshi3[3-i];
hc573(4);
Delay1ms(time*100);
}
}
}
}
void main(void)
{
uchar c=0,q=0;
sysinit();
AT24C02_Write(2,1);
Delay1ms(10);
AT24C02_Write(1,4);
Delay1ms(10);
Timer0_Init();
Timer1_Init();
P0 = 0xff;
hc573(4);
while(1)
{
temp = key_display();
LED();
if(temp==6)
{
ET1=1;change++;
}
if(change==1&&read_biaozhi==1)
{
ET0=0;
read_biaozhi=0;
moshi_led = AT24C02_Read(2);
time = AT24C02_Read(1);
}
if(temp==7)
{S7_biaozhi=!S7_biaozhi;dyci=1;ET0 = 1;
}
S6_cufa();//smg_display(4,change,0);
if(P33==0&&read_biaozhi==1)
{
while(1)
{
q = brightness-4;
if(test>=240)q=4;
ET0=0;
smg_display(0,18,0);
smg_display(1,18,0);
smg_display(2,18,0);
smg_display(3,18,0);
smg_display(4,18,0);
smg_display(5,18,0);
smg_display(6,0,0);
smg_display(7,q,0);
c = key_display();
if(P33!=0)
{
ET0=1;
smg_display(7,18,0);
break;
}
}
}
}
}
97409
- 粉丝: 145
- 资源: 3
最新资源
- ssm在线购书商城系统+vue.zip
- ssm在线云音乐系统的设计与实现+jsp.zip
- ssm园区停车管理系统+jsp.zip
- ssm影视企业全渠道会员管理系统的设计与实现+vue.zip
- ssm游戏攻略网站的设计与实现+vue.zip
- ssm医院住院综合服务管理系统设计与开发+vue.zip
- ssm亿互游在线平台设计与开发+vue.zip
- 三菱FX3U源码,三菱PLSR源码 总体功能和指令可能支持在RUN中下载程序,支持注释的写入和读取,有脉冲输出与定位指令(包括PLSY PWM PLSR PLSV DRVI DRVA 等指令)的代
- ssm应急资源管理系统+jsp.zip
- ssm医院门诊挂号系统+jsp.zip
- ssm医院住院管理系统+vue.zip
- ssm医用物理学实验考核系统+jsp.zip
- ssm学院学生论坛的设计与实现+vue.zip
- ssm医学生在线学习交流平台+vue.zip
- ssm亚盛汽车配件销售业绩管理统+jsp.zip
- 研控步进电机驱动器方案 验证可用,可以生产,欢迎咨询实际价格,快速掌握核心技术 包括硬件原理图 PCB源代码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈