How to control the uart

Here is my general idea.I generate a matrix in Matlab. I want to transmit the numbers in matrix into FPGA. And these numbers will be sent to an algorithm implemented FPGA board. The algorithm will deal with these numbers and new result is sent back to PC(Matlab, I want to compare the result from MATLAB).

I know transmitting these numbers to FPGA board. I need a UART. I have one. I also have done the algorithms in FPGA. But I don't know how to transmit the numbers from Matlab to FPGA. Exactly to say, I don't know how to control uart. How does uart know the data come in? Shall i add like "FF" file head to transmitting number? ...I am totally lost now. I have no idea how to connect Matlab to FPGA. Please give me some suggestions. Thanks.

Reply to
Loading thread data ...

Do a google search on "Matlab serial I/O". I came up with this rather promising link in under 30 seconds.

formatting link

You will need some sort of control logic in the FPGA to handle the UART, but if you are already implementing algo's in both MATLAB and VHDL/Verilog, a simple state machine should be no problem.

Reply to

Every byte of data sent via the UART starts with a start bit and ends with a stop bit (in the most commonly used scheme, 1 start bit, 1 stop bit, no parity). In between transmission of data, the UART holds the stop bit level. UART receivers therefore know that no data is being sent until it receives a start bit, and it knows that the next 8 bits are data.

All this is handled by the hardware and is largely transparent to you. Within the FPGA, the UART receiver will provide a bit indicating that data has been received.

Reply to
Duane Clark

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.