Skip to Main Content Skip to Search
Product Documentation

Introduction to CAN

xPC Target CAN Library

The xPC Target block library offers support to connect a target computer to a CAN network using the CAN driver blocks provided by the xPC Target I/O CAN block library. This support is for I/O device drivers for the CAN-AC2-ISA and CAN-AC2-PCI boards from Softing® GmbH (Germany). The CAN driver library allows xPC Target applications to connect to any CAN field bus network for I/O communication or real-time target-to-target communication.

These drivers support CAN specifications 2.0A and 2.0B and use the dynamic object mode of the CAN-AC2 firmware to achieve maximum real-time performance.

The xPC Target CAN library intentionally restricts its support to Softing boards with two CAN ports. To test the PCI and PC/104 boards, see the xpcdemos folder for simple loopback test models. Type the following commands to open the corresponding models. Some models use CAN_MESSAGE data types, some use double data types. Models that use double data types are considered legacy demos.

CAN-AC2-PCI Demo CAN-AC2-104 DemoDescription

CAN I/O - Simple Use Case — CAN_MESSAGE data type

CAN I/O - Simple Use Case — Double data type

CAN I/O - Simple Use Case — CAN_MESSAGE data type

CAN I/O - Simple Use Case — Double data type

Demonstrates simple CAN I/O communication.

CAN I/O - Message-Based Interrupts — CAN_MESSAGE data type

CAN I/O - Message-Based Interrupts — Double data type

CAN I/O - Message-Based Interrupts — CAN_MESSAGE data type

CAN I/O - Message-Based Interrupts — Double data type

Demonstrates asynchronous message-based event support using interrupt driven CAN I/O communication.

The size of the driver code of the CAN boards supported by the xPC Target block library is significant, and because not all xPC Target applications will use CAN, the CAN library code is not linked by default when building a target application. This non-linking makes target applications smaller if no CAN communication functionality is needed. If the model to be built contains CAN driver blocks, xPC Target links in the appropriate CAN library code when necessary.

For each CAN board three driver blocks are provided:

All drivers for the supported CAN boards program the boards for the so-called dynamic object mode. This is one of three modes the CAN board firmware from Softing can operate in. For a more detailed discussion of the three modes see the board's user manual. Dynamic object mode is best suited for real-time environments where each component of the application must have deterministic time behavior. This is the case for the xPC Target product, and that is the main reason why this mode has been chosen over the other two modes, which are FIFO and static object mode. In this mode, you use a separate port for each ID that you are sending or receiving. The blocks for these boards send messages in priority order, from the lowest ID to the highest.

Data Types

The xPC Target CAN blocks support the following message data types. If you have Softing ISA CAN boards, you can use only the double data type for messages. If you have Softing PCI and PC/104 CAN boards, you can use either CAN_MESSAGE or double data types data types for new messages.

Updating Existing Models to Use CAN_MESSAGE Data Types

If you have Softing PCI and PC/104 CAN boards, you can update existing models to use CAN_MESSAGE data types. As a rule:

See the CAN Blocks Transition document for more information.

Sending and Receiving Remote Frames

Ordinarily a subsystem sends its value over the CAN bus according to its own schedule, and another subsystem stores that value for use whenever downstream processing requires it. Under some circumstances, a subsystem explicitly requests the current value from another subsystem. This is called sending a remote frame.

Supported Softing Boards

The library supports the following CAN boards from Softing GmbH, Germany.

Board Name

Form Factor

Identifier Range

Multiple Board Support

CAN-AC2

ISA

Standard & Extended with piggyback module

No

CAN-AC2-PCI

PCI

Standard & Extended

Yes (up to 3)

CAN-AC2-104

PC/104

Standard & Extended

Yes (up to 3)

For more information on the board specifications, visit http://www.softing.com.

  


Related Products & Applications

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

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