Pro II: Extension and Interface Modules
Pro II-CAN-2 Rev. E
ADwin
160
ADwin-Pro II
Hardware, manual Dec. 2018
Message Management
Identifier
The CAN controller identifies messages by an identifier; these are parameters
in a defined bit length. The parameters 0...2
11
-1 or 0...2
29
-1 result from the bit
length.
Message objects
The controller stores each message (incoming or outgoing) in one out of 15
message objects. The message objects can either be configured to send or to
receive messages. Message object 15 can only be used to receive messages.
After initializing the CAN controller all message objects are not configured.
Each message object has an identifier, which enables the user to assign a
message to a message object.
Transferring messages
In
ADbasic
, a message is transferred to a message object using the array
can_msg
[]
, which can receive 8 data bytes plus the amount of data bytes (9
elements). When reading a message from the message object it can also be
transferred to the array
can_msg
[]
.
Sending messages
Sending a message is made as follows:
– You configure a message object to send and define the identifier of the
object (instruction
En_Transmit
).
– Save the message in
can_msg
[]
.
– Send the message (instruction
Transmit
). The message in the array
can_msg
[]
is transferred to the message object. As soon as the bus is
ready, the message is sent (with the identifier of the message object).
Receiving messages
Receiving a message is made as follows:
– You configure a message object to receive and define the identifier of
the object (instruction
En_Receive
).
– The controller monitors the CAN bus if there are incoming messages
and saves messages with the right identifier in the message object.
– Transfer the message from the message object into the array
can_msg
[]
(instruction
Read_Msg
) and read out the corresponding
identifier.
An arriving message overwrites the old data in the message object, which will
be definitely lost. Therefore, pay attention to reading out the data faster than
you are receiving them. A data loss is indicated by a flag.
The message object 15 has an additional buffer, so that 2 messages can be
stored there.
Assigning messages
The allocation of an arriving message to a message object is automatically
controlled by comparing its identifiers. The global mask (CAN registers 6...7 or
6...9) controls this comparison as follows:
– The identifier of the message is bit by bit compared to the identifier of the
message object. If the relevant bits are identical, the message is trans-
ferred to the message object. Not relevant bits are not compared to each
other, that is, the message is transferred to the object (if it depends on
this bit).
– Relevant bits are set in the global mask.
Global mask
With the global mask, a message object is used for receiving messages with
different identifiers
(ID). The following example shows the assignment of the
message IDs 1...4 to the message object IDs 1...4, when all bits of the global
mask are set, except the two least-significant bits (if you have an 11-bit identi-
fier it is
11111111100b
).