Apply Conditional Execution
You can apply conditional execution to determine whether the receiver blocks or System objects available in the Communications Toolbox™ Support Package for Xilinx® Zynq®-Based Radio receive valid data from the radio hardware.
Conditional Execution with Receiver Blocks
The AD936x Receiver and FMCOMMS5 Receiver blocks have a static data valid output port returning a logical value.
1indicates that the block has received data from the radio hardware.
0indicates that the block has not received data from the radio hardware. Either Simulink® runs faster than the radio hardware during simulation or the radio hardware has no new data to send to Simulink when the sampling occurs.
Any processing that occurs downstream of the receiver block must run only on valid data. To ensure that data is valid, control the data with an enabled subsystem. The data valid output serves as a convenient control signal for such an enabled subsystem.
To enable the data valid port of the AD936x Receiver block, on the
Advanced tab of the block mask, update Data timeout
(sec) to a value other than
Inf. When this value is
Inf, the block indefinitely waits for valid data and this
port is not required.
When used in a model, the output from this port can help determine data validity.
Conditional Execution with Receiver System Objects
When you call the
comm.SDRRxFMCOMMS5 System objects, the second output arguments is a logical value that indicates
validity of the data packets streaming to MATLAB® from the radio hardware.
trueindicates that the System object™ has received data from the radio hardware.
falseindicates that the System object has not received data from the radio hardware.
Any processing that occurs downstream of the System object must have conditions to accept only valid data. Note that if the
DataTimeout property is set to
object indefinitely waits for valid data. In this case, the second output argument of
the object indicating data validity is always
true and can be
Create a receiver System object.
rx = sdrrx('AD936x'); % Use second output argument for validation rx.DataTimeout = 0;
Receive data using the object. Validate data, then save valid data using a log.
Log = dsp.SignalSink; for counter = 1:20 [data,validData,overflow] = rx(); if validData == 1 if overflow ~=1 % contiguous data Log(data); end else disp('Not valid data.'); end end