0% found this document useful (0 votes)
10 views1 page

TX

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

TX

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

module uart_tx (

input wire clk,


input wire reset,
input wire [7:0] data_in, // Data to send
input wire tx_start, // Start transmission
input wire baud_tick, // Baud rate clock
output reg tx, // UART TX line
output reg tx_busy // Transmitter busy flag
);
reg [3:0] bit_idx;
reg [9:0] shift_reg;

always @(posedge clk or posedge reset) begin


if (reset) begin
tx <= 1'b1; // Idle state
tx_busy <= 1'b0;
bit_idx <= 0;
end else if (tx_start && !tx_busy) begin
shift_reg <= {1'b1, data_in, 1'b0}; // Start bit, data, stop bit
tx_busy <= 1'b1;
bit_idx <= 0;
end else if (baud_tick && tx_busy) begin
tx <= shift_reg[0];
shift_reg <= shift_reg >> 1;
bit_idx <= bit_idx + 1;
if (bit_idx == 9) tx_busy <= 1'b0;
end
end
endmodule

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy