Page 565 - 3-2
P. 565

motor<=2'b10; //B_D 닫힘
                            //B_D_flag <= 0;
                            motor_cnt<=motor_cnt+1;


                            if(motor_cnt>95299999) // 문 전부 닫혔을 때 //150000000 -> 12000000          으로 ㄱ
                            begin
                                    motor_cnt<=0;
                                    motor_flag<=0;
                            end
                    end
                    else // 아무것도 안하고 있을 때 여기에 있음 이때 송신 고!                  ~!
                    begin
                            door<=2'b0;
                            motor<=2'b0;
                            time_flag<=0;
                            //B_D_flag <= 1;
                    end
                    end
            end


            endmodule


            ---------------------------------
            sw_debouncing  모듈 센서 입력값 채터링 잡는 부분
            // d_sw output timing -> 50[Mhz]  기준 BOUNCING DELAY       뒤에 출력
            // BOUNCING_DELAY     값 조절가능


            module sw_debouncing (clk, rst, b_sw, d_sw);


                    input clk, rst, b_sw;


                    output reg d_sw;


                    reg [25:0] cnt;
                    reg     key_state;


                    parameter BOUNCING_DELAY = 12500000;            // boungcing count num
                    parameter ACTIVE_HIGH        = 1'b1;    // active_high switch
                    parameter ACTIVE_LOW         = 1'b0;    // active_low  switch
                    parameter KEY_ON                         = 0;
                    parameter KEY_OFF                        = 1;


                    always @(posedge clk, negedge rst) begin
                            if(!rst) begin
                                    cnt <= 0;


                                                         - 565 -
   560   561   562   563   564   565   566   567   568   569   570