overcur_ctrl.vhd

来自「大量VHDL写的数字系统设计有用实例达到」· VHDL 代码 · 共 29 行

VHD
29
字号
--过流保护程序
--电路将反馈电流转换为[-5--+5]范
--通过减法电路将之转换为[0--10]
--最后,通过分压电路将之转换为[0--5]
--作为ADC0809的输入信号
--中点为2.5v

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity overcur_ctrl is
 port(c0809in:in std_logic_vector(7 downto 0);
      posin :in std_logic_vector(7 downto 0); 
      en:out std_logic;
      ctrl_out:out std_logic_vector(7 downto 0));
end entity;

architecture one of overcur_ctrl is
 begin
   process(c0809in,posin)
    begin
        if c0809in>="01001101"  and c0809in<="10110100"then   --77~180 
              ctrl_out<=posin;en<='1';     --en为PWM波使能信号
        else  en<='1'; ctrl_out<=posin-"00101111";
        end if;
   end process;
end one;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?