Академический Документы
Профессиональный Документы
Культура Документы
A. Using C++
Referensi :
- https://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules
- https://www.youtube.com/watch?v=BW8o9ZgFJ5I
• Use Out of Tree module to create our own module gr-howto. gr_modtool script is used to
create files automatically.
• Use command in terminal to create module “gr-howto”
$ gr_modtool newmod howto
this is will create new directory called gr-howto
• to create empty files for block, go to directory gr-howto and type the command below :
gr-howto$ gr_modtool add -t general square_ff
• the run() method runs the graph until all the blocks indicate they are finished.
• Finally, we check that the result of executing square_ff on scr_data matches what we expect.
• Now we need to modify lib/square_ff_impl.cc
◦ gr_modtool hints at where you have to change code by adding <++> symbols
◦ open the file and modify it accordingly :
gr-howto/python$ cd ..
gr-howto$ cd lib
gr-howto/lib$ ls
gr-howto/lib$ sudo gedit square_ff_impl.cc
◦ input and output signature specifies min and max no of input and output ports along this
type of ports
◦ here we have only 1 input and 1 output port and that of type float.
◦ Forecast() is a function which tells the scheduler how many input items are required to
produce noutput_items output items.
◦ Here they are same and hence input_items_required[0] = noutput_items;
◦ the index 0 indicates that this is for the first port.
◦ general_work() is the method that does the actual signal processing
◦ let's modify it to get square of input value
• now lets build and compile our files using Cmake
◦ first go to directory gr-howto and type commands below :
r-howto$ mkdir build
r-howto$ cd build
r-howto/build$ cmake ../
r-howto/build$ make
◦ lets try running 'make test', type command below :
gr-howto/build$ make test
• lets try running 'make test', type command below :
gr-howto/build$ make test
• if everything is fine, then create XML code using gr_modtool script
◦ go to gr-howto directory and type below command :
gr-howto$ gr_modtool makexml square_ff
gr-howto$ gr_modtool makexml square_ff
GNU Radio module name identified: howto
Warning: This is an experimental feature. Don't expect any magic.
Searching for matching files in lib/:
Making GRC bindings for lib/square2_ff_impl.cc...
Overwrite existing GRC file? [y/N] y