xPC Target | ![]() ![]() |
CAN-AC2-ISA with Philips PCA82C200
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 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 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 dialog field (pop-up) allows to specify the memory-address range used to access the board. The CAN-AC2 can be mapped into memory between D0000-EFFFF. See the CAN-AC2 user's guide for further information. If used with xPC Target memory mapped I/O-devices can only be mapped into a subarea of the choosable memory range of the CAN-AC2.
We recommend to use the following configurations if using xPC Target Version 1.1
The second and third 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 manual for detailed information how to set the user defined baudrates.
With the fourth and fifth dialog field the baudrate for CAN-port 2 can be set.
The last 4 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 0..2031. In a vector each identifier can only be set once.
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 the 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-ISA | CAN-AC2-ISA with Intel 82527 | ![]() |