xPC Target    

CAN-AC2-PCI with SJA 1000

The second level of the library contains three driver blocks; one for setting up the board, one for sending CAN-messages, and one for receiving CAN-messages.

Setup Block

Every Simulink model which sends and receives CAN-messages over the CAN-AC2-PCI board has to contain exactly one Setup block. The Setup block does not have any inputs or outputs.

The dialog box allows to define general settings for the CAN-AC2-PCI board. The corresponding code (initializing the board) is executed once during the "initializing blocks" phase after the xPC Target application has been downloaded.

The first and second dialog field allows to choose the baudrate of CAN-port 1. If the baudrate within the pop-up menu is not set to User defined, the entries in the user defined dialog field have no meaning. If it is set to User defined, a wide range of baudrates can be set by setting Prescaler, Width, Tseg1, Tseg2 to appropriate values. See the CAN-AC2-PCI manual for detailed information how to set the user defined baudrates.

With the third and fourth dialog field the baudrate for CAN-port 2 can be set.

The last four dialog entries are used to define the identifiers of all CAN-messages sent or received within the current Simulink model. There is one dialog field for send- and receive-identifiers for CAN-port 1 and 2. Each entry can contain a row vector with a maximal number of 200 identifiers. Each identifier can be in the range of -(2^29)..2031). Because CAN-specification 2.0B allows to send and receive messages with standard (11bit) and extended identifiers (29bit) concurrently, the following identifier numbering method has been implemented:

Send-block

To send CAN-messages specified in the setup-block, a Simulink model can contain as many as needed send-blocks.

The first dialog entry specifies via which CAN-port the CAN-message should be sent.

The second dialog entry specifies the identifiers for CAN-messages to be sent. The identifiers, entered as a row vector, have to be a subset of the send identifiers defined in the setup-block of either CAN-port 1 or 2. If an identifier is specified that is not defined in the Setup block, an error message appears after the xPC Target application is downloaded. The block has as many inputs as the row vector has elements.

The data (double / 8byte) of the first input is sent as the CAN-message with the identifier of the first element of the vector. The second input is sent with the identifier of the second element of the vector and so on.

The third dialog field specifies at which sample time intervals the CAN-messages are sent. By using more than one Send block, it is possible to send CAN-messages at different sample time intervals even with the same identifiers by entering appropriate sample times for each Send block.

Receive Block

To receive CAN-messages specified in the Setup block, a Simulink model can contain as many as needed Receive blocks.

The first dialog entry specifies from which CAN-port the CAN-message should be received.

The second dialog entry specifies the identifiers for CAN-messages to be received. The identifiers, entered as a row vector, have to be a subset of the receive identifiers defined in the Setup block of either CAN-port 1 or 2. If an identifier is specified that is not defined in the Setup block, an error message appears after the xPC Target application is downloaded. The block has as many outputs as the row vector has elements. The data (double / 8byte) received with the identifier as the first element of the output is the first block output and so on.

The third dialog field specifies at which sample time intervals the CAN-messages have to be read out of the object buffer. By using more than one Receive block, it is possible to get CAN-messages at different sample time intervals even with the same identifiers by entering appropriate sample times for each Receive block.


  CAN-AC2-PCI CAN-AC2 and CANopen Devices