1、 rx_detect_module.v模塊,input rx_pin_in; output L_sig ;
201711vncns333bnnnsei6.png (17.79 KB, 下載次數(shù): 84)
下載附件
2016-3-3 19:10 上傳
2、 波特率模塊(rx_bps_module)也比較簡單,就它吧。
Input bps_count;rx_receive_module模塊來的計數(shù)標(biāo)志位
reg [12:0] BPS_Conut;(計數(shù)) 2^13 = 8 192>5027,BPS_Conut=5027時歸零,等于2604時讀出即output BPS_CLK;
201825okwnmak8w1uz1r88.png (21.08 KB, 下載次數(shù): 100)
下載附件
2016-3-3 19:10 上傳
rx_receive_module.v模塊感覺挺復(fù)雜的,信號多,不好寫,就寫led_Control_module.v模塊吧。因為他就和rx_receive_module.v相關(guān)。
Input led_Begin_work;
input RX_Data;
Output led;
202027c5fh9t3xq3ah93kx.png (20.92 KB, 下載次數(shù): 87)
下載附件
2016-3-3 19:10 上傳
就差rx_receive_module,想想它怎么寫:
Input rx_pin_in(數(shù)據(jù)) L_Sig(低電平) BPS_CLK(波特率計滿)
Output BPS_Conut,(波特率計數(shù)信號) led_Begin_work(開始信號)RX_Data(傳值)、
202124cz8mz7om7csogmop.png (21.38 KB, 下載次數(shù): 86)
下載附件
2016-3-3 19:10 上傳
還有倆個模塊,勝利在望啊。
先rx_control_module.v模塊。把那三個綜合一下,進(jìn)的進(jìn),出的出,模塊之間的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
-
-
-
復(fù)制代碼