xPC Target    

FIFO Write Driver Block

The FIFO Write driver block is used to write CAN messages into the transmit FIFO. The firmware running in FIFO mode processes the information found in the transmit FIFO and finally puts the constructed CAN messages onto the bus.

The block has one input port of type double. At this port, all necessary information has to be provided in order to construct valid CAN messages to be written into the transmit FIFO. For each CAN message, 5 elements have to be passed, which are

Port -- The value can be either 1 (port 1) or 2 (port 2) and defines at which port the CAN message is sent out from.

Identifier -- This is the identifier of the CAN message to be sent out. If it is a Standard CAN message the valid range is 0 to 2047. If the CAN message is extended, the range is 0 to 229-1.

Identifier type -- The value can be either 0 (Standard identifier range) or 1 (Extended identifier range) and defines the identifier type of the outgoing CAN message.

Data frame size -- The value can be in the range of 0 to 8 and defines the data frame size in bytes of the outgoing CAN message

Data -- This is the data for the data frame itself and is defined as a double value (8 bytes). The CAN packing block is used to construct the data as a double value.

Because all this information can be dynamically changed in FIFO mode during application execution, the information is provided at the block input instead of using block parameters. In order to be able to transmit more than one CAN message per block instance, a matrix signal is used as a container for all information.

The dimension of the matrix signal entering the block has to be n*5, where n is the number of CAN messages to be sent out by this block instance. Therefore each row of the matrix signal defines one CAN message and each row combines the 5 elements of information defined above (in this order).

For more on how to construct the correct matrix signal for the FIFO write block, see Examples.

For certain applications it may be necessary to make the writing of a CAN message into the transmit FIFO dependent on the model dynamics. For this case, the matrix signal can also be of dimension n*6 instead of n*5. In this case, the sixth column defines if the corresponding CAN message is written into the transmit FIFO (value 1) or not (value 0).

The dialog box of the block lets you define the following settings.

Board -- Define which physically present board is used to send out the CAN messages defined by this block instance. For more information about the meaning of the board number see the Setup driver block described above. If just one board is present in the target system, you should select 1.

Show status output port -- Check this box to enable the status output port. If the box is unchecked, the block does not have an output port. If enabled, a port is shown. The signal leaving the block is a vector of type double where the number of elements depends on the signal dimension of the block input port. There is one element for each CAN message written into the transmit FIFO and the value is identical to the return argument of function CANPC_send_data(...) described in the Softing user manual. Refer to that manual for more information.

Sample time -- Defines the sample time at which the FIFO Write block is executed during a model (target application) run.

You can use as many instances of the FIFO Write block in the model as needed. For example by using two instances of the block, different sample times at which CAN messages are sent out can be defined. Or you can use multiple instances to structure your model more efficiently.


  FIFO Setup Driver Block FIFO Read Driver Block