Page 567 - 3-2
P. 567

begin
                            clk_cnt<=clk_cnt+1;
                            clk_flag<=clk_flag;
                    end


                    else
                    begin
                            clk_cnt<=0;
                            clk_flag<=~clk_flag;
                    end
            end


            always @(posedge clk)
            begin
                    if(clk_flag)
                    begin
                            motor_1<=2'b10;
                            motor_2<=2'b01;
                    end


                    else
                    begin
                            motor_1<=2'b01;
                            motor_2<=2'b10;
                    end
            end
            endmodule


            ---------------------------------uart_rx1         통신 모듈
            module uart_rx1(clk,reset,rxd,tx_out,microsw,Light,fan,B_D); //tx:  송신단자 ->  송신 모듈 //,B_D_flag
            ,fail_flag
            input [3:0]microsw;
            input reset,clk;    //,B_D_flag
            input rxd; //,fail_flag
            output tx_out;//tx:  송신단자
            output reg [1:0]Light,fan;
            output reg B_D;


            // 송신 변수
            reg clk_uart;
            //9600bps ->  시스템 클럭이 5625       번 들어올 때 1
            reg [19:0] clk_count;
            //5625 까지 세기 위한 변수
            reg [7:0]tx_reg;
            // 송신하고자 하는 데이터를 보관하는 변수


                                                         - 567 -
   562   563   564   565   566   567   568   569   570   571   572