UChar To Float: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Created page with "Category:Block Docs Category:Stub Docs This is the template for the "Page-per-block Docs". This first section should describe what the block...")
 
(Added a second example - the raw output values of a RTL-SDR (collected using the "rtl_sdr" command))
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Block Docs]]
[[Category:Block Docs]]
[[Category:Stub Docs]]
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.
This is the template for the [[:Category:Block_Docs|"Page-per-block Docs"]].  This first section should describe what the block does and how to use it, using however many paragraphs necessary. Note that the title of the wiki page should match the block's name in GRC, i.e. the one defined in the block's .grc file.  Look at the [[FFT]] Block for a good example.


As this is a basic template, it's also in the [[:Category:Stub_Docs|"Stub Docs category"]]. Please improve it.
== Example Flowgraphs ==


== Parameters ==
=== Example #1 - Showing Binary Values ===
(''R''): <span class="plainlinks">[https://wiki.gnuradio.org/index.php/GNURadioCompanion#Variable_Controls ''Run-time adjustable'']</span>
This flowgraph shows the outputs of AND, OR, and XOR logic blocks converted to Float to display in a Time Sink.


; Param 1 (''R'')
[[File:And_Or_Xor_fg.png|700px]]
: Description of parameter, provide any tips or recommended values.  Note that the name of the parameter above should match the param's label that shows up in grc (e.g. Sample Rate).
[[File:And_Or_Xor_out.png|700px]]


; Param 2
=== Example #2 - Showing the Raw Output Values of a RTL-SDR ===
: blah blah blah


== Example Flowgraph ==
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.


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.
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++ fileshttps://wiki.gnuradio.org/index.php/SISO
; C++ files
 
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/uchar_to_float_impl.cc]
: [https://github.com/gnuradio/gnuradio TODO]


; 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]