• 大小: 23KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-10
  • 语言: 其他
  • 标签: LED  源程序  

资源简介

旋转LED模拟时钟程序源程序 旋转LED模拟时钟程序源程序 旋转LED模拟时钟程序源程序 旋转LED模拟时钟程序源程序 STC89C52 74HC595

资源截图

代码片段和文件信息

#include“H_test.h“
unsigned int code Date_12[142]={0xc18a0xe3ab0xf7a2//12
0xffff0xfffe0xffff0xfffe0xffff0xfffe0xfff8//0~5
0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfff8//5~10
0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfff0//10~15
0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfff8//15~20
0xffff0xfffe0xffff0xfffe0xffff
0xf3fe0xf7bf0xf03e0xf7bf0xf3f8//20~25
0xffff0xf73e0xf6bf0xf6be0xf9bf0xfffe0xf7ff0xf03e0xffbf0xffb0//25~30
0xffbf0xf03e0xf7df0xf83e0xf73f0xf6be0xf7bf0xf87e0xffff0xfbf8//30~35
0xf7bf0xf7be0xf7bf0xf87e0xffff0xfffe0xffff0xfffe0xffff0xfff8//35~40
0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfff0//40~45
0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfff8//45~50
0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfffe0xffff0xfff8//50~55
0xffff0xfffe0xffff0xfffe0xffff0xfffe//55~60
0xfff70xf7820xe3ff0xffff0xffff0xffff0xffff0xffff0xffff0xffff
0xffff0xffff0xffff0xffff0xffff0xffff0xffff
0xffff0xffff0xffff0xffff0xffff0xffff0xffff
};
unsigned int Buffer=0Time_flag=0THTL_FLAG=0THTL_FLAG2=0;
unsigned char iDex=0;
unsigned char Hour=3Minute=40Second=45Hour_Flag=0;
unsigned int QPFlag=0xffff;
char cFlag=1;
void Time_Show(int *mchar *Flag);
void Time_Amend();
void Hour_Test();
void Minute_Test();
void Second_Test();
 //定时器T0的中断服务程序
void  kjp_test(void)interrupt 1 using 1
{
Buffer++;
Time_flag++;
TH0=-THTL_FLAG/256; //定时初值,5MS
TL0=-THTL_FLAG%256;
if(Buffer==1)    //计时为BUFFER*5MS 的时间
{
if(iDex<122)
{
Led_Display();   //向模拟的串中P1口传送数据来控制74HC595 来控制LED
iDex++;
}
Buffer=0;

}   
if(Time_flag==1000)
{
Second++;
Time_Amend();
Time_flag=0;
}

}
void  kjp_T1(void)interrupt 3 using 3
{
TH1=1;TL1=1;
THTL_FLAG2++;  
}
 void  INT00(void)interrupt 0 using 2
 {
 iDex=0;
 MR=0;
 THTL_FLAG=65536/124;
 THTL_FLAG*=THTL_FLAG2;
 THTL_FLAG+=(TH1*0x100+TL0)/124;
 THTL_FLAG2=0;
 TH1=1;
 TL1=1;
 }
void Hour_Test()
{
unsigned char i=0j=0;
if(Hour!=0)
{
Hour_Flag=Minute/12;
i=10*Hour+2*Hour_Flag;
j=i+1;
if(iDex==j||iDex==(i-3))
{
PFlag=0xefff;
Q&=PFlag;
}
if(iDex==i||iDex==(i-2))
{
PFlag=0xe7ff;
Q&=PFlag;
}

if(iDex==(i-1))
{
PFlag=0x03ff;
Q&=PFlag;
cFlag=0;
}
}
else
{
if(iDex==0)
 {
    PFlag=0x03ff;
Q&=PFlag;
cFlag=0;
 }
 if(iDex==1||iDex==119)
 {
  PFlag=0xe7ff;
P&=PFlag;
 }
 if(iDex==2||iDex==118)
 {
  PFlag=0xefff;
P&=PFlag;
 } 
}

}
void Minute_Test()
{
unsigned char i=0j=0;


if(Minute!=0)
{
i=2*Minute+1;
if(iDex==i||iDex==2*Minute-3)
{
PFlag=0xfdff;
Q&=PFlag;
}
if(iDex==(2*Minute)||iDex==(2*Minute-2))
{
PFlag=0xfcff;
Q&=PFlag;
}
if(iDex==2*Minute-1

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5304  2003-07-09 23:36  test7_2\74hc595.c

     文件      14598  2003-07-09 23:36  test7_2\74hc595.LST

     文件      14280  2003-07-09 23:36  test7_2\74hc595.OBJ

     文件        113  2003-06-07 17:15  test7_2\74hc595_main.c

     文件       1140  2003-07-09 23:36  test7_2\74hc595_main.LST

     文件       1297  2003-07-09 23:36  test7_2\74hc595_main.OBJ

     文件        236  2003-06-14 17:54  test7_2\H_test.h

     文件      12411  2003-07-09 23:36  test7_2\test7_2

     文件          0  2003-07-03 13:12  test7_2\test7_2.c

     文件       4471  2003-07-09 23:36  test7_2\test7_2.hex

     文件         67  2003-07-09 23:36  test7_2\test7_2.lnp

     文件      19199  2003-07-09 23:36  test7_2\test7_2.M51

     文件       1472  2003-07-10 00:38  test7_2\test7_2.Opt

     文件       1253  2003-07-10 00:38  test7_2\test7_2.plg

     文件       2202  2003-07-03 16:07  test7_2\test7_2.Uv2

     文件       1620  2003-07-07 21:19  test7_2\test7_2_Opt.Bak

     文件          0  2003-07-03 13:11  test7_2\test7_2_Uv2.Bak

     目录          0  2003-07-10 03:41  test7_2

----------- ---------  ---------- -----  ----

                79663                    18


评论

共有 条评论