Ivan-Holm
Member level 5
- Joined
- Jun 3, 2010
- Messages
- 84
- Helped
- 3
- Reputation
- 6
- Reaction score
- 2
- Trophy points
- 1,288
- Location
- Denmark
- Activity points
- 1,894
We are trying to do some homework making a RS232 transmitter...
This is what we made so far and there is a lot of faults it it.. but we don't know what. We think its something with the way we written the states. Please rewrite it to some useful syntax
this is what we made so far
This is what we made so far and there is a lot of faults it it.. but we don't know what. We think its something with the way we written the states. Please rewrite it to some useful syntax
this is what we made so far
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity RS232_TX is Port ( Baud_clk_Par_Ser_Conv : in STD_LOGIC; -- Baud rate CLK TX : out STD_LOGIC_VECTOR ( 10 downto 0 ); -- TX Data: in STD_LOGIC_VECTOR ( 7 downto 0 ) -- Data stream ); end RS232_TX; architecture RS232 of RS232_TX is shared variable T_1 : std_logic_vector (3 downto 0); --BEGIN MAIN PROCESS --RS232_TX : process (Baud_clk_Par_Ser_Conv) begin -- BEGIN PROCESS Counter_1 Counter_1 : process (Baud_clk_Par_Ser_Conv) variable T : integer range 0 to 11; begin if Baud_clk_Par_Ser_Conv' event and (Baud_clk_Par_Ser_Conv = '1') then T := T+1; if T >= 11 then T := 0; end if; T_1 := CONV_STD_LOGIC_VECTOR(T, 4); end if; end process; -- END PROCESS Counter_1 -- BEGIN PROCESS RS232_TX RS232_TX : process (Data, Baud_clk_Par_Ser_Conv) variable TX_1 : STD_LOGIC_VECTOR ( 9 downto 0 ); variable rs232 : STD_LOGIC_VECTOR ( 9 downto 0 ); Begin if (Baud_clk_Par_Ser_Conv ='1') then -- Baud rate CLK Case T_1 is When "0000" => TX_1 <= rs232(0)<= "0"; -- Startbit --Data Stream When "0001" => TX_1 <= Data(0); -- Data Stream 1 When "0010" => TX_1 <= Data(1); -- Data Stream 2 When "0011" => TX_1 <= Data(2); -- Data Stream 3 When "0100" => TX_1 <= Data(3); -- Data Stream 4 When "0101" => TX_1 <= Data(4); -- Data Stream 5 When "0110" => TX_1 <= Data(5); -- Data Stream 6 When "0111" => TX_1 <= Data(6); -- Data Stream 7 When "1000" => TX_1 <= Data(7); -- Data Stream 8 When "1001" => TX_1 <= rs232(9)<="1"; -- Stopbit (in binary) when others => null; -- default state end Case; end if; TX <= TX_1; end process; -- END PROCESS RS232_TX --end process; -- END PROCESS Main end RS232;
Last edited: