ifm
System Manual
ecomat
mobile
SmartController (CR2500) V05
CAN in the ecomatmobile controller
Exchange of CAN data
49
8.2
Exchange of CAN data
CAN data is exchanged via the CAN protocol of the link layer (level 2) of the seven-layer ISO/OSI
reference model specified in the international standard ISO 11898.
Every bus participant can transmit messages (multimaster capability). The exchange of data functions
similarly to radio. Data is transferred on the bus without transmitter or address. The data is only
marked by the identifier. It is the task of every participant to receive the transmitted data and to check
by means of the identifier whether the data is relevant for this participant. This procedure is carried out
automatically by the CAN controller together with the operating system.
For the normal exchange of CAN data the programmer only has to make the data objects with their
identifiers known to the system when designing the software. This is done via the following functions:
•
function
CANx_RECEIVE
(
→
page
) (receive CAN data) and
•
function
CANx_TRANSMIT
(
→
page
) (transmit CAN data).
Using these functions the following units are combined into a data object:
•
RAM address of the useful data,
•
data
type,
•
selected identifier (ID).
These data objects participate in the exchange of data via the CAN bus. The transmit and receive
objects can be defined from all valid IEC data types (e.g. BOOL, WORD, INT, ARRAY).
The CAN message consists of a CAN identifier (CAN-ID,
→
) and maximum 8 data bytes. The
ID does not represent the transmit or receive module but identifies the message. To transmit data it is
necessary that a transmit object is declared in the transmit module and a receive object in at least one
other module. Both declarations must be assigned to the same identifier.
8.2.1
CAN-ID
Depending of the CAN-ID the following CAN identifiers are free available for the data transfer:
CAN-ID base
CAN-ID extended
11 bits
29 bits
2 047 CAN identifiers
536 870 912 CAN identifiers
Standard applications
Motor management (SAE J1939),
Truck & Trailer interface (ISO 11992)
NOTE
In some devices the 29 bits CAN-ID is not available for all CAN interfaces,
→
datasheet.