Page 983 - 3-2
P. 983

else if(state == idle) rs_flag <= 0;
                    end



            // 스텝모터 돌리기

            always @ (posedge clk, negedge rst) //0.01  초마다 클럭 ++
            begin

             if(!rst)
             begin

              clk_cnt <= 0;
              step_clk <= 0;

              motor_step_clk <= 0;
             end

             else
             begin

              if(state == idle && sen_buff == 8'hfe)
              begin

               current_sector <= 0;
               clk_cnt <= 0;

              end
              else if(state == idle && sen_buff != 8'hfe)

              begin
               if(clk_cnt == clk_figure)

               begin
                step_clk <= ~step_clk;

                clk_cnt <= 0;
               end

               else
               begin

                step_clk <= step_clk;
                clk_cnt <= clk_cnt + 1;

               end
              end

              else if(angle_set != 0 && state == turn_motor)
              begin

               if(clk_cnt == clk_figure) //1Mhz 고 문이 닫혀있으면
               begin



                                                         - 983 -
   978   979   980   981   982   983   984   985   986   987   988