How can I send complex data using serial communication to an fpga?
1 回表示 (過去 30 日間)
古いコメントを表示
I developed a UART system for a Virtex 5 Xilinx FPGA. It work fine but I only sent binary data. In the other hand, my main function gives me a complex data which I want to send using the uart unit.
%main function
function tx = main_fcn(rx)
rx = uart_rx();
%I receive binary data from my uart_rx
rx = [1 0 1 0 1 1 0 0]; %as example
%Then I modulate rx
x = qpsk(rx);
%x = 1 + j; %as example
Xt = ifft(x); %then I calculate de IFFT of x
%I want to send Xt = a + bj to my uart_tx
tx = uart_tx(Xt);
the problem is that I need to send indiviual bits to my uart_tx (8-databits) but I have a complex number.
So my question is how I can covert the Xt complex number into binary data to sent it to the computer using my uart unit.
0 件のコメント
採用された回答
Walter Roberson
2016 年 11 月 15 日
Pull apart the number using real() and imag() and send the pieces .
3 件のコメント
Walter Roberson
2016 年 11 月 20 日
There are many ways to convert floating point to binary.
Since you are using FPGA you should be using the fixed point toolbox. The fixed point toolbox offers a method to extract the bit sequence of the representation. Look at the properties and methods of fixed point objects.
Walter Roberson
2016 年 11 月 20 日
For any given fi, say A, you can
bin(A) - '0'
to get the bit values. If you follow RS232 protocol, you need to transmit the least significant bit first, which would be right to left in the order you get from bin()
The start bits and stop bits are constants, logical 0 (positive voltage) for the start bit, and logical 1 (negative voltage) for the stop bit; https://wcscnet.com/tutorials/introduction-to-rs232-serial-communication/
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!