[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Stream tag/Message passing loops
From: |
Martin Braun |
Subject: |
Re: [Discuss-gnuradio] Stream tag/Message passing loops |
Date: |
Mon, 20 Jun 2016 14:06:42 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 |
Ngai,
we have an example for this in uhd_msg_tune.grc. Maybe that'll give you
a clue.
M
On 06/14/2016 12:14 PM, Ngai-Han Liu wrote:
> Hi there,
>
> I've been playing around with message passing and stream tags as a
> beginner and am trying to allow the centre frequency of my USRP be
> changed via message passing command based on some basic if statements.
>
> I made a conceptual system where when my custom sink block receives a
> propagated stream tag (rx_freq from the USRP). It enters the IF
> statement which then passes a message to USRP source to change its
> frequency.
>
> It looks something like this:
>
> std::vector<tag_t> tags;
> get_tags_in_range(
> tags,
> 0,
> abs_N,
> end_N,
> pmt::intern("rx_freq")
> );
>
> pmt::pmt_t command = pmt::cons( // Make a pair
> pmt::mp("freq"), // Key is 'freq' => sets the frequency
> pmt::mp(98.8e6)); // Set the frequency to 1.1 GHz
>
> if (tags.size()>0)
> {
> message_port_pub(pmt::mp("freq"),command);
> double b = pmt::to_double(tags[0].value);
> cout << b << endl;
> }
>
> When I first start the flow graph, even if my default frequency is
> something arbitrary e.g. 200mhz, the stream tag on startup sends the
> command and the USRP recentres to 98.8MHz. So far so good...
>
> I also have QT gui variable which allows me to change the frequency of
> USRP using a slider. What I anticipated for this loop to do is when the
> slider is moved, it causes USRP to change frequency which triggers its
> stream tag to propagate. Which then causes it tune back to 98.8.
>
>
> Now the strange thing is when my sink block receives this message. It
> goes into the if loop, and sends the command. But it is completely
> ignored!! Could anyone tell me why this might be?
>
>
> Many thanks,
> Ngai
>
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>