FIFO Read HDRS block
Simulink® Real-Time™ Library for RS-232
The FIFO Read HDRS block identifies and separates ASCII data streams that have embedded identifiers.
The data following a particular header can have varying lengths,
but has a common termination marker such as
Although you can attain this same functionality with the FIFO
Read/Write (Composite) block, doing so requires a complicated
state machine with the following behavior:
If the same header arrives in the FIFO more than once after the block was last executed, the block returns the latest instance of the header. In this way, the block catches up with data that arrives faster than the block executes.
If a header arrives in the FIFO that does not match an item in the headers list, the block discards the message.
If bytes arrive in the FIFO that do not match a header, the block interprets the message as having an unspecified header. The block skips these bytes.
contains the following examples that illustrate how to use the FIFO
Read HDRS block:
Enter the headers that you want the block to look for in a block of data from the FIFO. Enter each header as an element in a cell array.
Enter the terminating character vector for the data. Enter the characters defining the end of character vector, typically one or two characters.
From the list, select the behavior of the block if the FIFO has not received new data. Select Zero output if no new data if you want the block to have no output if the FIFO has no new data. Select Hold last output if no new data if you want the block to keep the output from the last FIFO message.
Select this check box to turn on a new input that takes Boolean signals that enable or disable the read.
Enter the largest desired read size in bytes. This parameter specifies the width of the output vector and the maximum number of elements to return. See Output vector type for more information about data formats.
From the list, select
count+32 bit int,
count+16 bit int,
8 bit int null terminated,
8 bit uint null terminated. This parameter specifies
the output vector type. The 8-bit data types produce a null terminated
character vector in the output vector. For 16- and 32-bit data types,
the first element contains the number of elements that are valid in
the rest of the output vector.
Base sample time or a multiple of the base sample time.