--开始位检测 process(clk,cs_n,idle) variable counta:std_logic_vector(3 downto 0); begin if(cs_n='0')then counta:="0000"; work_op<='0';--0:不接受数据 else if(idle='0')then work_op<='1'; counta:="0000"; else if(clk'event and clk='0') then case counta is when "1100"=>work_op<='1'; when others=>if(rs232_din='0')then counta:=counta+1; else counta:="0000"; end if; work_op<='0'; end case; end if; end if; end if; 这是我串口检测信号的程序,差不多,你看看吧,应该有帮助的吧 |