on key 'a'
{
long err;
pg * msg;
dword counter = 0;
msg.PGN = 0xF123; //DCDC4OS
msg.SA = 0x1;
msg.dlc = 8;
msg.byte(0) = 0x01;
msg.byte(1) = 0x02;
msg.byte(2) = 0x03;
msg.byte(3) = 0x04;
msg.byte(4) = 0x05;
msg.byte(5) = 0x06;
msg.byte(6) = 0x07; // Bits 4-8 will be overwritten with the message counter
msg.byte(7) = 0x08; // Will be overwritten with the checksum
if(J1939SetChecksumAndCounter(msg, "Aa", counter) != 0)
{
write("Error while setting checksum and counter");
}
counter = (counter + 1) % 16;
output(msg);
}