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:
1 | type transmit_state_t is (IDLE, BYTE0, BYTE1, BYTE2, BYTE3, STOP); |
2 | |
3 | constant STX : natural := 2; -- start of text |
4 | constant ETX : natural := 3; -- end of text |
5 | |
6 | ...
|
7 | |
8 | tx_enable <= '0'; |
9 | |
10 | case transmit_state is |
11 | |
12 | when IDLE => |
13 | if new_data then |
14 | tx_enable <= '1'; |
15 | tx_data <= to_unsigned( STX, tx_data'length); |
16 | transmit_state <= BYTE0; |
17 | end if; |
18 | |
19 | when BYTE0 => |
20 | tx_enable <= '1'; |
21 | tx_data <= data( 7 downto 0); |
22 | transmit_state <= BYTE1; |
23 | ...
|
24 | when STOP => |
25 | tx_enable <= '1'; |
26 | tx_data <= to_unsigned( ETX, tx_data'length); |
27 | transmit_state <= IDLE; |
28 | |
29 | end case; |
30 | |
31 | ...
|
I add STX and ETX to get a chance to synchronice the whole sequence on the receiver. Duke
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.