always @(posedge clk or negedge rst_n)begin
if(!rst_n)begin
sda_dout <= 1'b1 ;
end
else if(state_c == START)begin
if(cnt_scl == `HIGH_HALF)begin
sda_dout <= 1'b0 ;
end
else if(cnt_scl == `LOW_HALF)begin
sda_dout <= 1'b1 ;
end
end
else if(state_c == WR_DATA && cnt_scl == `LOW_HALF)begin
sda_dout <= dout_data[7 - cnt_bit] ;
end
else if(state_c == SEND_ACK && cnt_scl == `LOW_HALF)begin
sda_dout <= (command & `STO) ? 1'b1 : 1'b0 ;
end
else if(state_c == STOP)begin
if(cnt_scl == `LOW_HALF)begin
sda_dout <= 1'b0;
end
else if(cnt_scl == `HIGH_HALF)begin
sda_dout <= 1'b1;
end
end
else if(wrdata2recack | rddata2sendack)begin
sda_dout <= 1'b1;
end
end
————————————————
————————————————
i2c中的串并转换模块不太理解,为什么有SEND_ACK
却没有REC_ACK