reg [1:0]num_80ns; reg clk_80ns; //*******************************分频程序********************** always @(posedge clk) begin if(num_80ns==2'd1) begin num_80ns=2'd0; clk_80ns=~clk_80ns; end else begin num_80ns=num_80ns+1'b1; end
always @(posedge clk_80ns or negedge rst) begin if(!rst) begin state_7818<=6'd0;
end else begin case(state_7818) 0: begin CLK_7818<=1'b0; state_7818<=6'd1; end 1: //clk up 1 begin CLK_7818<=1'b1; CONV_7818<=1'b1; state_7818<=6'd2;
end 2: begin
CLK_7818<=1'b0; state_7818<=6'd3; end 3: //clk up 2 begin
CLK_7818<=1'b1; AD_reg[11]<=DATA_7818; state_7818<=6'd4; end 4: begin
CLK_7818<=1'b0; state_7818<=6'd5; end 5: //clk up 3 begin CLK_7818<=1'b1; AD_reg[10]<=DATA_7818; state_7818<=6'd6; end 6: begin CLK_7818<=1'b0; state_7818<=6'd7;
end 7: //clk up 4 begin CLK_7818<=1'b1; AD_reg[9]<=DATA_7818; state_7818<=6'd8; end 8: begin CLK_7818<=1'b0; state_7818<=6'd9; end 9: //clk up 5 begin CLK_7818<=1'b1; AD_reg[8]<=DATA_7818; state_7818<=6'd10; end 10: begin CLK_7818<=1'b0; state_7818<=6'd11; end 11: //clk up 6 begin CLK_7818<=1'b1; AD_reg[7]<=DATA_7818; state_7818<=6'd12; end 12: begin CLK_7818<=1'b0; state_7818<=6'd13; end 13: //clk up 7 begin CLK_7818<=1'b1; AD_reg[6]<=DATA_7818; state_7818<=6'd14; end 14: begin CLK_7818<=1'b0; state_7818<=6'd15; end 15: //clk up 8 begin CLK_7818<=1'b1; AD_reg[5]<=DATA_7818; state_7818<=6'd16; end 16: begin CLK_7818<=1'b0; state_7818<=6'd17; end 17: //clk up 9 begin CLK_7818<=1'b1; AD_reg[4]<=DATA_7818; state_7818<=6'd18; end 18: begin CLK_7818<=1'b0; state_7818<=6'd19; end 19: //clk up 10 begin CLK_7818<=1'b1; AD_reg[3]<=DATA_7818; state_7818<=6'd20; end 20: begin CLK_7818<=1'b0; state_7818<=6'd21; end 21: //clk up 11 begin CLK_7818<=1'b1; AD_reg[2]<=DATA_7818; state_7818<=6'd22; end 22: begin CLK_7818<=1'b0; state_7818<=6'd23; end 23: //clk up 12 begin CLK_7818<=1'b1; AD_reg[1]<=DATA_7818; state_7818<=6'd24; end 24: begin CLK_7818<=1'b0; state_7818<=6'd25;
end 25: //clk up 13 begin CLK_7818<=1'b1; AD_reg[0]<=DATA_7818; state_7818<=6'd26; end 26: begin CLK_7818<=1'b0; state_7818<=6'd27; end 27: //clk up 14 begin CLK_7818<=1'b1; state_7818<=6'd28; end 28: begin CLK_7818<=1'b0; state_7818<=6'd29; end 29: //clk up 15 begin CLK_7818<=1'b1; AD_result<=AD_reg; //将采集的12位数据打入出输出 state_7818<=6'd30;
end 30: begin CLK_7818<=1'b0; state_7818<=6'd31; end 31: //clk up 16 begin
文章评论(0条评论)
登录后参与讨论