Page 110 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 110

interrupt  [TIM0_OVF]  void  time_count(void)
            {
                 count++;

                 if  (count ==  25)
                 {
                       sec  += 1;

                       if  (sec  >=  60)                                                                         //초
                       {
                            sec  =  0;
                            min  +=  1;
                       }

                       if  (min  >= 60)                                                                          //분
                       {
                            min  =  0;
                            hour  +=  1;
                       }

                       if  (hour  >=  24)                                                                          //시
                       {
                            hour  =  0;
                       }

                       count  =  0;
                 }
            }

            interrupt  [TIM2_OVF]  void  time_count2(void)
            {
                count2++;

                if  (count2  == 25)
                 {
                       tsec  -= 1;
                       if  (tsec  ==  0)
                       {
                            TCCR2  =  0x00;
                       }

                       count2 = 0;
                 }
            }




                                                         -  103  -
   105   106   107   108   109   110   111   112   113   114   115