measureBwide:process(inputHClk)
begin
if rising_edge(inputHClk) then
if pwmMeasureEnable=′1′ then
--上升沿开始计数
regCountH<=regCountH+1;
--计数器++
regOutputReadEnable<=′0′;
--此时数据不可读
else null;
end if;
if (regBLast=′1′)and( regBCurrent=′0′) then
--降沿判断脉宽
case (regCountH) is
when 5000 to 14000 =>
regOutputData<="0010";
- regOutputPwm0Or1<=′0′;
when 20000 to 30000=>
regOutputData<="0101";
regOutputPwm0Or1<=′1′;
when 35000 to 48000=>
regOutputData<="1000";
regOutputPwm0Or1<=′0′;
when others=>NULL;
regOutputPwm0Or1<=′0′;
end case;
regCountH<=0;
regOutputReadEnable<=′1′;
--此时数据可读
else null;
end if;
else NULL;
end if;
end process measureBwide;