Capl Message Can
Capl Message Can
Capl Message Can
Without a database
-----------------
Message Selectors|
-----------------
----
CAN |
----
on key '1' {
write("sende via CAN 1");
msg.CAN = 1;
output(msg);
}
on key '2' {
write("sende via CAN 2");
msg.CAN = 2;
output(msg);
}
----
ID |
----
on message * {
if (this.ID == 0x600) {
write("message 0x600 received; triggering logging...");
trigger();
}
}
----
DIR |
----
on message 0x100 {
if (this.DIR == Rx) {
write("message 0x100 received");
}
if (this.DIR == Tx) {
write("message 0x100 sent");
}
}
----
RTR | Remote Transmission Request
----
----
TYPE| Combination of DIR and RTR for an efficient evaluation. (TYPE = (RTR << 8) |
DIR )
----
on message 0x100 {
if (this.TYPE == RXREMOTE) {
// remote frame 0x100 received
output(resp_msg);
}
}
----
DLC |
----
on message OneByteMessage {
if (this.DLC != 1) {
write("error: OneByteMessage has DLC != 1");
stop();
}
}
-----------------
Accessing Data |
-----------------
BYTE (8 bits), WORD (16 bits), LONG (32 bits), and DWORD (32 bits).
----------------------------------------------------------------------------
WORD_0 || WORD_1 || WORD_2 || WORD_3 |
----------------------------------------------------------------------------
Byte_0 || Byte_1 || Byte_2 || Byte_3 || Byte_4 || Byte_5 || Byte_6 || Byte_7|
-----------------------------------------------------------------------------
6E || 01 || FF || 51 || 7A || B5 || C9 || 23 |
-----------------------------------------------------------------------------
Messagename.BYTE(0) = 6E
Messagename.BYTE(5) = B5
Messagename.WORD(0) 0x16E
Messagename.WORD(3) 0x7A51
Messagename.LONG(0) 0x51FF016E
Messagename.LONG(2) 0xB57A51FF
Messagename.LONG(4) 0x23C9B57A
Messagename.LONG(6) Invalid
--------------------
message Transmission|
--------------------
--------------------
message Reception |
--------------------
on message ABSdata
{
if (this.DIR == RX)
{
write(�Message ID = %d is received from channel %d�, this.ID, this.CAN);
write(�The signal value of car speed is %d�, this.CarSpeed);
}
}