16*64LED dot matrix clock (moving + page turning display) MCU source program

Publisher:清晨微风Latest update time:2020-08-20 Source: 51heiKeywords:16*64  clock  MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

                disp_mode=mode[mode_counter];

                }               

                break;               

                                

                case 1: //year adjustment

                disp_mode=3;

                if(add_flag==1)

                {

            add_flag=0;

                                CurrentTime.Year++;

                                if(CurrentTime.Year>99) CurrentTime.Year=0;

                                DS1302_SetTime(DS1302_YEAR,(CurrentTime.Year));

                }

                if(dec_flag==1)

                {

            dec_flag=0;

                                if(CurrentTime.Year>0) CurrentTime.Year--;

                                if(CurrentTime.Year==0) CurrentTime.Year=99;

                                DS1302_SetTime(DS1302_YEAR,(CurrentTime.Year));

                }

                break;


                  case 2: //monthly adjustment

                disp_mode=4;

                if(add_flag==1)

                {

            add_flag=0;

                                CurrentTime.Month++;

                                if(CurrentTime.Month>12) CurrentTime.Month=1;

                                DS1302_SetTime(DS1302_MONTH,(CurrentTime.Month));

                }

                if(dec_flag==1)

                {

            dec_flag=0;

                                if(CurrentTime.Month>0) CurrentTime.Month--;

                                if(CurrentTime.Month==0) CurrentTime.Month=12;

                                DS1302_SetTime(DS1302_MONTH,(CurrentTime.Month));

                }

                break;


                case 3: //Daily adjustment

                disp_mode=5;

                if(add_flag==1)

                {

            add_flag=0;

                                CurrentTime.Day++;

                                if(CurrentTime.Day>31) CurrentTime.Day=1;

                                DS1302_SetTime(DS1302_DAY,(CurrentTime.Day));

                }

                if(dec_flag==1)

                {

            dec_flag=0;

                                if(CurrentTime.Day>0) CurrentTime.Day--;

                                if(CurrentTime.Day==0) CurrentTime.Day=31;

                                DS1302_SetTime(DS1302_DAY,(CurrentTime.Day));

                }

                break;


                case 4: //week adjustment

                disp_mode=6;

                if(add_flag==1)

                {

            add_flag=0;

                                CurrentTime.Week++;

                                if(CurrentTime.Week>7) CurrentTime.Week=1;

                                DS1302_SetTime(DS1302_WEEK,(CurrentTime.Week));

                }

                if(dec_flag==1)

                {

            dec_flag=0;

                                if(CurrentTime.Week>1) CurrentTime.Week--;

                                if(CurrentTime.Week==1) CurrentTime.Week=7;

                                DS1302_SetTime(DS1302_WEEK,(CurrentTime.Week));

                }

                break;


                case 5: //Hour adjustment

                disp_mode=2;

                if(add_flag==1)

                {

            add_flag=0;

                                CurrentTime.Hour++;

                                if(CurrentTime.Hour>23) CurrentTime.Hour=0;

                                DS1302_SetTime(DS1302_HOUR,(CurrentTime.Hour));

                }

                if(dec_flag==1)

                {

            dec_flag=0;

                                if(CurrentTime.Hour>0) CurrentTime.Hour--;

                                if(CurrentTime.Hour==0) CurrentTime.Hour=23;

                                DS1302_SetTime(DS1302_HOUR,(CurrentTime.Hour));

                }

                break;


                case 6: //Minute adjustment

                disp_mode=2;

                if(add_flag==1)

                {

            add_flag=0;

                                CurrentTime.Minute++;

                                if(CurrentTime.Minute>59) CurrentTime.Minute=0;

                                DS1302_SetTime(DS1302_MINUTE,(CurrentTime.Minute));

                }

                if(dec_flag==1)

                {

            dec_flag=0;

                                if(CurrentTime.Minute>0) CurrentTime.Minute--;

                                if(CurrentTime.Minute==0) CurrentTime.Minute=59;

                                DS1302_SetTime(DS1302_MINUTE,(CurrentTime.Minute));

                }

                break;


                case 7: //seconds adjustment

                disp_mode=2;

                if(add_flag==1)

                {

            add_flag=0;                                

                                CurrentTime.Second++;

                                if(CurrentTime.Second>59) CurrentTime.Second=0;

                                DS1302_SetTime(DS1302_SECOND,(CurrentTime.Second));

                }

                if(dec_flag==1)

                {

            dec_flag=0;                                

                                if(CurrentTime.Second>0) CurrentTime.Second--;

                                if(CurrentTime.Second==0) CurrentTime.Second=59;

                                DS1302_SetTime(DS1302_SECOND,(CurrentTime.Second));

                }

                break;


                default:

                break;

        }

}


[1] [2] [3] [4]
Keywords:16*64  clock  MCU Reference address:16*64LED dot matrix clock (moving + page turning display) MCU source program

Previous article:51 MCU NY3P035 voice broadcast source program
Next article:Single chip LCD12864 with font library can call display function can reverse display source program

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号