在spartan 3上启用gpio引脚

时间:2015-03-22 14:27:55

标签: gpio spartan

我正在尝试使用spartan 3 fpga板运行直流电机,我需要从电路板上取出2个引脚作为电机驱动器的输入引脚。我无法启用它们。我已经将它们声明为std_logic并且我还为它们生成了一个约束文件,但在检查了这些引脚上的输出后,我得到了0volts。 我应该在代码中写什么,我必须将它们声明为信号吗? 请告诉我如何在vhdl代码中启用它们。下面我给了我的vhdl代码

`entity dc_motor is
port ( clk : in std_logic;
       rst : in std_logic;
       io_pin1:  out std_logic;
       io_pin2 : out std_logic);
end dc_motor;

architecture Behavioral of dc_motor is

begin
process(rst,clk)
variable i : integer := 0;
begin
if rst = '1' then
if clk'event and clk = '1' then
--enable <= '1';
if i <= 1005000 then
i := i + 1;

io_pin1 <= '0';
io_pin2 <= '0';
elsif i > 1005000 and i < 1550000 then
i := i + 1;
 io_pin1 <= '1';
 io_pin2 <= '0';
elsif i = 1550000 then
i := 0;
end if;
end if;
end if;
end process;
end Behavioral;
`

0 个答案:

没有答案
相关问题