FPGA实现双向管脚?
XC2S15 + ISE6.1
FPGA实现双向管脚?
没明白你说的意思
把源代码贴出来
FPGA实现双向管脚?
se IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are
--provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;
entity XC2S15 is
Port (
I: INOUT STD_LOGIC_VECTOR(15 DOWNTO 0)--D0-D15
);
end XC2S15;
architecture Behavioral of XC2S15 is
SIGNAL ADD: STD_LOGIC_VECTOR (13 DOWNTO 0);
SIGNAL OUTPUT : STD_LOGIC_VECTOR (10 DOWNTO 0);
begin
ADD(13)<=A(10); --\
ADD(12)<=A(9);--|
ADD(11)<=A(8);--|
ADD(10)<=A(7);--|
ADD(9)<=A(6);--|
ADD(8)<=A(5);--|
ADD(7)<=A(4);--> ADD
ADD(6)<=A(3);--|
ADD(5)<=A(2);--|
ADD(4)<=A(1);--|
ADD(3)<=A(0);--|
ADD(2)<=IOR1;--|
ADD(1)<=IOW1;--|
ADD(0)<=AEN1; --/
OUTPUT<="00000111100" WHEN ADD="01100000000010" ELSE --0X300--read BUFX tatus
"00001111100" WHEN ADD="01100000010100" ELSE --0X302--write stages
"00000111111" ;
Y5<=OUTPUT(5);
Y4<=OUTPUT(4);
Y3<=OUTPUT(3);
Y2<=OUTPUT(2);
Y1<=OUTPUT(1);
IO16<=OUTPUT(0);
PROCESS(OUTPUT)
BEGIN
CASE OUTPUT IS
WHEN "00000111100" =>--READ BUF STATUS0X300
I(0)<=BUF2;
WHEN "00001111100" =>--WRITE STAGE
STAGESBUF2<=I; --0X302
WHEN OTHERS=>
I<="ZZZZZZZZZZZZZZZ";
END CASE;
END PROCESS;
I是ISA总线,I(0)读出的数据是对的,但写到STAGESBUF2的最低位始终为0,其他位正确。?
FPGA实现双向管脚?
WHEN "00000111100" =>--READ BUF STATUS0X300
I(0)<=BUF2;
I(15 DOWNTO 1) <="ZZZZZZZZZZZZZZ"; --加上它可以吗
FPGA实现双向管脚?
谢谢,高人,可以!