I am trying to emulate Checksum logic using CAPL. I have 8 byte of message. I want to sum first 7 bytes followed by Xor with 0xFF
and store this value into 8th byte. So far things are working well. However, while running below code, values do update locally but not on the CAN message. I learned that there are some limitation while sending CAN message using CAPL on Canalyzer. Is there any solution to this problem?
on message X
{
sum = 0;
// Sum the first seven bytes of the message
for (i = 0; i < 7; i++)
{
sum += this.byte(i);
}
// XOR the sum with 0xFF to get the checksum
checksum = sum ^ 0xFF;
// Assign the checksum to the 7th byte (index 7) of the message
this.byte(7) = checksum;
// Print the calculated checksum for debugging purposes
write("Calculated checksum: 0x%02X", checksum);
// Transmit the modified message
output(this);
}
Output(this)
works only locally. It means it does not publish the CAN message while simulation is running. Can anyone help to solve this issue?