I am new in VHDL programming. I have an output of counter of 32-bit data. Now I want to transmit the 32 bit through the rs232 protocol which can send 8-bit data once. I am attaching my UART file, DCFIFO of 32 to 8-bit mix file baud rate generator file and the counter file. Can anybody help me how to port map them to get 32-bit data transmitted?
I would suggest a state machine to control the transmisson:
type transmit_state_t is (IDLE, BYTE0, BYTE1, BYTE2, BYTE3, STOP); constant STX : natural := 2; -- start of text constant ETX : natural := 3; -- end of text ... tx_enable <= '0'; case transmit_state is when IDLE => if new_data then tx_enable <= '1'; tx_data <= to_unsigned( STX, tx_data'length); transmit_state <= BYTE0; end if; when BYTE0 => tx_enable <= '1'; tx_data <= data( 7 downto 0); transmit_state <= BYTE1; ... when STOP => tx_enable <= '1'; tx_data <= to_unsigned( ETX, tx_data'length); transmit_state <= IDLE; end case; ...
I add STX and ETX to get a chance to synchronice the whole sequence on the receiver. Duke
Thank you very much for your kind help.