Products & Services Industries Academia Support User Community Company

Learn more about xPC Target   

FIFO Read/Write (Composite) - FIFO Read/Write

Library

xPC Target Library for RS232

Description

This section describes the FIFO Read and Write blocks. Of particular note are the FIFO Read blocks, of which there are three. Use the following guidelines when using these blocks:

All three FIFO read block types need their input to be of type serialfifoptr, which is output from F type Send Receive subsystems.

The following are examples of when you can use the FIFO read block.

The FIFO Read block is the read side of a FIFO read/write pair. There are two modes for this block:

The FIFO Write block is the write side of a FIFO read/write pair.

FIFO Read Block Parameters

Maximum read size

Specify the maximum number of characters that you will ever expect to be returned by this block. The resulting vector size will be one more than this maximum number of characters. This block needs the extra element to contain the number of characters that are being returned. The block contains the characters as either

  • A null terminator for the 8–bit data types

  • The character count for the 16– and 32–bit data types

Be sure to enter a large enough number. If this number is too small, the block might not be able to return anything. If this number is larger than necessary, there is no effect. For example, if you enter a value 10, but on execution there are 11 characters up to the terminator in the FIFO, the block will not return any characters.

If you select the parameter Max and Min read size ports, the block interprets the value input on this port to be the maximum number of characters to return. The actual maximum number of characters to return is the smaller of the value on the max input port or the maximum read size in the block parameters. This is mainly useful in binary mode when the Read to delimiter check box is not selected.

Minimum read size

Enter the smallest desired read size in bytes. The FIFO must contain at least this number of elements before any elements will be returned. If you select the Max and Min read size ports check box, this value is superseded by the external signals.

Read to delimiter

Select this check box to enable the return of element sets that terminate with the Delimiter value. Use this parameter when working with character-based elements.

Delimiter

Enter the decimal value for an 8-bit input terminator. This parameter specifies the value on which a FIFO read operation should terminate. It works with the Read to delimiter parameter. By default, this block looks for a carriage return. It only returns characters when one is found. For reference, the decimal value of a carriage return is 13, a line feed is 10.

Output vector type

From the list, select count+32 bit int, count+32 bit uint, count+16 bit int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null terminated. This parameter specifies the output vector type. The 8-bit data types produce a null terminated string in the output vector. For 16- and 32-bit data types, the first element contains the number of elements to expect in the rest of the output vector.

Max and Min read size ports

Select this check box to enable the maximum and minimum input ports. When this check box is selected,

The value from the maximum input port is the maximum number of characters to be removed from the FIFO. Note that if this number exceeds the value of Maximum read size, the block disregards the value from the maximum input port and takes the value of Maximum read size as the maximum number of characters to be removed from the FIFO.

The value from the minimum input is the minimum number of characters the FIFO must contain before any elements can be returned. This value supersedes the value set with the Minimum read size parameter.

Enable passthrough

Select this check box to pass the maximum read input through to the passthrough output.

SampleTime

Base sample time or a multiple of the base sample time.

FIFO Write Block Parameters

Size

Enter the number of elements that can be held in the FIFO at any one time. If a write operation to the FIFO causes the number of elements to exceed Size, an error occurs.

Input vector type

From the list, select count+32 bit int, count+32 bit uint, count+16 bit int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null terminated. This parameter specifies the input vector type. The 8-bit data types need a null terminated string in the output vector. For 16- and 32-bit data types, the first element contains the number of elements to expect in the rest of the input vector.

Data present output

Select this check box to create a Boolean output that is true if data is present in the FIFO. The transmit side of the send/receive subsystem uses this output. This output is given to the Enable TX block, which enables the transmitter buffer empty interrupt.

SampleTime

Base sample time or a multiple of the base sample time.

ID

Enter a user-defined identifier for overflow messages.

Example

The following are some examples of how you can set up the FIFO Read block:

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS