1、 rx_detect_module.v模块,input rx_pin_in; output L_sig ;
2、 波特率模块(rx_bps_module)也比较简单,就它吧。
Input bps_count;rx_receive_module模块来的计数标志位
reg [12:0] BPS_Conut;(计数) 2^13 = 8 192>5027,BPS_Conut=5027时归零,等于2604时读出即output BPS_CLK;
rx_receive_module.v模块感觉挺复杂的,信号多,不好写,就写led_Control_module.v模块吧。因为他就和rx_receive_module.v相关。
Input led_Begin_work;
input RX_Data;
Output led;
就差rx_receive_module,想想它怎么写:
Input rx_pin_in(数据) L_Sig(低电平) BPS_CLK(波特率计满)
Output BPS_Conut,(波特率计数信号) led_Begin_work(开始信号)RX_Data(传值)、
还有俩个模块,胜利在望啊。
先rx_control_module.v模块。把那三个综合一下,进的进,出的出,模块之间的wire 就OK啦。
- module rx_receive_module(
- clk,rst_n,
- rx_Pin_In,L_Sig,BPS_CLK,
- BPS_Conut,led_Begin_work,RX_Data
- );
-
- input clk ;
- input rst_n;
- input rx_Pin_In;
- input L_Sig;
- input BPS_CLK;
- output BPS_Conut;
- output led_Begin_work;
- output [7:0] RX_Data;
- reg [3:0] i;
- reg [7:0] data;
- reg bps_Begin;
- reg led_Begin;
- always @(posedge clk or negedge rst_n)
- if(!rst_n)
- begin
- i <= 4'd0;
- data <= 8'd0;
- bps_Begin <= 1'b0;
- led_Begin <= 1'b0;
- end
- else
- case(i)
- 4'd0:
- if(!L_Sig)
- begin
- i <= i+1'b1;
- bps_Begin <= 1'b1;
- end
-
- 4'd1:
- if(BPS_CLK)
- i <= i+1'b1;
-
- 4'd2,4'd3,4'd4,4'd5,4'd6,4'd7,4'd8,4'd9:
- if(BPS_CLK)
- begin
- i <= i+1'b1;
- data[i-2] <= rx_Pin_In;
- end
-
- 4'd10:
- if(BPS_CLK)
- i = i+1'b1;
-
- 4'd11:
- if(BPS_CLK)
- i= i +1'b1;
-
- 4'd12:
- begin
- i <= i +1'b1;
- bps_Begin <= 1'b0;
- led_Begin <= 1'b1;
- end
-
- 4'd13:
- begin
- i <= 4'd0;
- led_Begin <= 1'b0;
- end
- endcase
-
- assign BPS_Conut = bps_Begin;
- assign led_Begin_work = led_Begin;
- assign RX_Data = data;
-
- endmodule
-
-
-
复制代码