EmbDev.net

Forum: FPGA, VHDL & Verilog 32 bit data transmitt through rs232 protocol


Author: Hari Kumar (Company: student) (hari29)
Posted on:
Attached files:

Rate this post
0 useful
not useful
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?

Author: Duke Scarring (Guest)
Posted on:

Rate this post
0 useful
not useful
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

Author: Hari Kumar (Company: student) (hari29)
Posted on:

Rate this post
0 useful
not useful
Thank you very much for your kind help.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig