|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
// counter for gen a clk_50k : need count to 1000, for 50M/1000 = 50K hz
always @(posedge sys_clk or negedge sys_rst_n) begin
if (sys_rst_n ==1'b0)
counter_div <= 10'b0;
else if (counter_div >= 10'd999)
counter_div <= 10'b0;
else
counter_div <= counter_div + 10'b1;
end
// gen a clk_50k use counter_div : not use counter_div 0 - 500 is for i2c bus request start timing
always @(posedge sys_clk or negedge sys_rst_n) begin
if (sys_rst_n ==1'b0)
clk_50k <= 10'b0;
else if ((counter_div >= 375) && (counter_div < 875))
clk_50k <= 10'b1;
else
clk_50k <= 10'b0;
end
请教一下 为什么要从375到875,如果没有这个程序是不是就不是50K 为什么?? |
|