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

always @ (posedge  clk, negedge  rst)
             begin
                    if(!rst)cnt_sec  <=  0;
                    else
                    begin
                            if(cnt_sec  ==  50000000) cnt_sec  <=  0;  //  0.5초마다  깜빡이기
                            else  cnt_sec  <=  cnt_sec  +  1;
                    end
             end
             always @ (posedge  clk, negedge  rst)
             begin
                    if(!rst)  cnt_clk<=0;
                    else
                    begin
                            if(cnt_clk==249999)  cnt_clk<=0;
                            else  cnt_clk<=cnt_clk+1;
                    end
             end


             always  @  (posedge  clk,  negedge  rst)       //  100m초  카운트
             begin
                    if(!rst)  cnt_100ms<=0;
                    else
                    begin
                            if(state==delay_100ms)
                            begin
                                    if(cnt_clk==249999)
                                    begin
                                            if(cnt_100ms==19)  cnt_100ms<=0;
                                            else  cnt_100ms<=cnt_100ms+1;
                                    end
                            end
                            else  cnt_100ms<=0;
                    end
             end


             always  @  (posedge  clk,  negedge  rst)       //  25m초  카운트
             begin
                    if(!rst)  cnt_50ms<=0;




                                                         -  409  -
   411   412   413   414   415   416   417   418   419   420   421