D
dev648237923
Guest
I am hobbiest.
I have the Spartan 3 Starter Kit. I want to try to send data to my PC via
Serial Port.
I tried the following but the data is sporadic -- can anyone tell what is
wrong.
PC: Hyperteminal 8N1 Hardware Flow Control
VHDL:
I try to make a 10-bit shift register an dthen just send ascii "7" (hex 37)
over and over. I have 0 as startbit and 1 as stop bit and the ox37 in the
middle. I have counter to change clock from 50MHz to 9600Hz
entity shifter2 is
port (
clock : in std_logic;
enabled : in std_logic; --Spartan Board SW0
txd : out std_logic --Spartan DB9 Connector TXD
);
end shifter2;
architecture Behavioral of shifter2 is
--The 50MHz clock is too fast so I will use this counter to
--obtain a slower counting speed. I will increment count_int
--each time this counter reaches back around to zero
signal ctr : std_logic_vector(24 downto 0) := "0000000000000000000000000";
signal sr: std_logic_vector(9 downto 0) := "0000000000";
signal srout: std_logic := '0';
begin
process (clock)
begin
if clock'event and clock='1' then
if (enabled='1') then
if (ctr="0000000000000000000000000") then
sr(0) <= sr(9);
sr(1) <= sr(0);
sr(2) <= sr(1);
sr(3) <= sr(2);
sr(4) <= sr(3);
sr(5) <= sr(4);
sr(6) <= sr(5);
sr(7) <= sr(6);
sr(8) <= sr(7);
sr(9) <= sr(8);
srout <= sr(9);
end if;
ctr <= ctr + "0000000000000000000000001";
if (ctr > "0000000000001010001011000") then --9600Hz
ctr <= "0000000000000000000000000";
end if;
end if;
if (enabled='0') then
ctr <= "0000000000000000000000000";
srout <= '1';
sr <= "0111011001";
end if;
end if;
end process;
txd <= srout;
end Behavioral;
Thank you!
I have the Spartan 3 Starter Kit. I want to try to send data to my PC via
Serial Port.
I tried the following but the data is sporadic -- can anyone tell what is
wrong.
PC: Hyperteminal 8N1 Hardware Flow Control
VHDL:
I try to make a 10-bit shift register an dthen just send ascii "7" (hex 37)
over and over. I have 0 as startbit and 1 as stop bit and the ox37 in the
middle. I have counter to change clock from 50MHz to 9600Hz
entity shifter2 is
port (
clock : in std_logic;
enabled : in std_logic; --Spartan Board SW0
txd : out std_logic --Spartan DB9 Connector TXD
);
end shifter2;
architecture Behavioral of shifter2 is
--The 50MHz clock is too fast so I will use this counter to
--obtain a slower counting speed. I will increment count_int
--each time this counter reaches back around to zero
signal ctr : std_logic_vector(24 downto 0) := "0000000000000000000000000";
signal sr: std_logic_vector(9 downto 0) := "0000000000";
signal srout: std_logic := '0';
begin
process (clock)
begin
if clock'event and clock='1' then
if (enabled='1') then
if (ctr="0000000000000000000000000") then
sr(0) <= sr(9);
sr(1) <= sr(0);
sr(2) <= sr(1);
sr(3) <= sr(2);
sr(4) <= sr(3);
sr(5) <= sr(4);
sr(6) <= sr(5);
sr(7) <= sr(6);
sr(8) <= sr(7);
sr(9) <= sr(8);
srout <= sr(9);
end if;
ctr <= ctr + "0000000000000000000000001";
if (ctr > "0000000000001010001011000") then --9600Hz
ctr <= "0000000000000000000000000";
end if;
end if;
if (enabled='0') then
ctr <= "0000000000000000000000000";
srout <= '1';
sr <= "0111011001";
end if;
end if;
end process;
txd <= srout;
end Behavioral;
Thank you!