Hello,
I seem to be having from problems reading values from the XEM 3001. I am writing a simple c# program to control the LEDs and read the buttons state. I can control the LEDs easily without any problems, however reading the buttons appears to not be working at all for me. I feel that the API is straightforward enough that I didn’t make any mistakes in the code but will post it anyways.
VHDL
[CODE]library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
–library UNISIM;
–use UNISIM.VComponents.all;
entity pcControl is
port (
hi_in : in std_logic_vector(7 downto 0);
hi_out : out std_logic_vector(1 downto 0);
hi_inout : inout std_logic_vector(15 downto 0);
clk1 : in std_logic;
led : out std_logic_vector(7 downto 0);
button : in std_logic_vector(3 downto 0)
);
end pcControl;
architecture rtl of pcControl is
component okHostInterface port (
hi_in : in std_logic_vector(7 downto 0);
hi_out : out std_logic_vector(1 downto 0);
hi_inout : inout std_logic_vector(15 downto 0);
ti_clk : out std_logic;
ok1 : out std_logic_vector(30 downto 0);
ok2 : in std_logic_vector(16 downto 0));
end component;
component okWireIn port (
ok1 : in std_logic_vector(30 downto 0);
ok2 : out std_logic_vector(16 downto 0);
ep_addr : in std_logic_vector(7 downto 0);
ep_dataout : out std_logic_vector(15 downto 0));
end component;
component okWireOut port (
ok1 : in std_logic_vector(30 downto 0);
ok2 : out std_logic_vector(16 downto 0);
ep_addr : in std_logic_vector(7 downto 0);
ep_datain : in std_logic_vector(15 downto 0));
end component;
signal ti_clk : std_logic;
signal ok1 : std_logic_vector(30 downto 0);
signal ok2 : std_logic_vector(16 downto 0);
signal ledWire : std_logic_vector(15 downto 0);
signal buttonWire : std_logic_vector(15 downto 0);
begin
led ok1,
ok2 => ok2,
ep_addr => x"00",
ep_dataout => ledWire
);
–Map buttons to PC
buttonW : okWireOut port map (
ok1 => ok1,
ok2 => ok2,
ep_addr => x"01",
ep_datain => buttonWire
);
okHI : okHostInterface port map (
hi_in => hi_in,
hi_out => hi_out,
hi_inout => hi_inout,
ti_clk => ti_clk,
ok1 => ok1,
ok2 => ok2
);
end rtl;[/CODE]
C# code where I read the buttons
m_dev.UpdateWireOuts();
int temp = m_dev.GetWireOutValue(0x01);
buttonStateLabel.Text = temp.ToString();
Any thoughts? I know the “First” sample program works with the buttons but appears not to be working with the C# API. Thanks.