UChar To Float: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
No edit summary
(Added a second example - the raw output values of a RTL-SDR (collected using the "rtl_sdr" command))
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Block Docs]]
[[Category:Block Docs]]
Convert stream of unsigned chars to a stream of floats.
Convert stream of unsigned chars to a stream of floats. A ''UChar'' data type is an unsigned 8-bit integer, meaning it will have integer values between 0 - 255.


== Example Flowgraph ==
== Example Flowgraphs ==


Insert description of flowgraph here, then show a screenshot of the flowgraph and the output if there is an interesting GUI. Currently we have no standard method of uploading the actual flowgraph to the wiki or git repo, unfortunately. The plan is to have an example flowgraph showing how the block might be used, for every block, and the flowgraphs will live in the git repo.
=== Example #1 - Showing Binary Values ===
This flowgraph shows the outputs of AND, OR, and XOR logic blocks converted to Float to display in a Time Sink.
 
[[File:And_Or_Xor_fg.png|700px]]
[[File:And_Or_Xor_out.png|700px]]
 
=== Example #2 - Showing the Raw Output Values of a RTL-SDR ===
 
Samples collected using the "rtl_sdr" command from a terminal will collect raw samples as provided by a RTL-SDR. These are unsigned 8-bit integer values, meaning they have values from 0 - 255.
 
The flowgraph used to read the sample file is as follows:
 
[[File:Uchar-to-Float-block-usage-with-RTLSDR-flowgraph.png|800px]]
 
The flowgraph takes the values and uses the ''UChar to Float'' block to input the samples from the original file source. The [[Stream Demux]] block separates the real and imaginary samples, which are input to the [[Float To Complex]] block. The [[QT GUI Time Sink]] shows the complex samples with values from 0 - 255, as shown below.
 
[[File:Uchar-to-Float-time-sink-from-RTLSDR-file.png|800px]]


== Source Files ==
== Source Files ==


; C++ files
; C++ files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/uchar_to_float_impl.cc]


; Header files
; Header files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/uchar_to_float_impl.h]


; Public header files
; Public header files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/include/gnuradio/blocks/uchar_to_float.h]


; Block definition
; Block definition
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/grc/blocks_uchar_to_float.block.yml]

Latest revision as of 02:51, 23 March 2025

Convert stream of unsigned chars to a stream of floats. A UChar data type is an unsigned 8-bit integer, meaning it will have integer values between 0 - 255.

Example Flowgraphs

Example #1 - Showing Binary Values

This flowgraph shows the outputs of AND, OR, and XOR logic blocks converted to Float to display in a Time Sink.

And Or Xor fg.png And Or Xor out.png

Example #2 - Showing the Raw Output Values of a RTL-SDR

Samples collected using the "rtl_sdr" command from a terminal will collect raw samples as provided by a RTL-SDR. These are unsigned 8-bit integer values, meaning they have values from 0 - 255.

The flowgraph used to read the sample file is as follows:

Uchar-to-Float-block-usage-with-RTLSDR-flowgraph.png

The flowgraph takes the values and uses the UChar to Float block to input the samples from the original file source. The Stream Demux block separates the real and imaginary samples, which are input to the Float To Complex block. The QT GUI Time Sink shows the complex samples with values from 0 - 255, as shown below.

Uchar-to-Float-time-sink-from-RTLSDR-file.png

Source Files

C++ files
[1]
Header files
[2]
Public header files
[3]
Block definition
[4]