How can I send complex data using serial communication to an fpga?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Pablo Medina
am 15 Nov. 2016
Kommentiert: Walter Roberson
am 20 Nov. 2016
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 15 Nov. 2016
Pull apart the number using real() and imag() and send the pieces .
3 Kommentare
Walter Roberson
am 20 Nov. 2016
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
am 20 Nov. 2016
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/
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!