I am sending a CAN message from a database,
variables
{
message PNHV_Energy msg;
}
output (msg);
This message has 5 signals
signal A: 1 bit - startbit is 28
signal B: 3 bit - startbit is 29
signal C: 16bit - startbit is 48
signal D: 8 bit - startbit is 32
signal E: 8 bit - startbit is 40
How do I construct this and send it? The problem I face is in signal A and signal B, which are packed in one byte at location A: 1bit-28. signal B: 3bit-29 to 30.
what value for byte 3 should be set in?
msg.byte(3)= ?
It uses a little-endian format.
Variables of type message
are classes in CAPL. If drawed from a valid CAN database, they come pre-packed with all the signals associated with them. Let us see an example
Variables
{
message PHNV_Energy msg;
}
on start {
/* at the beginning of measurement, set the signals */
msg.A = 0x00;
msg.B = 0x00;
msg.C = 0x00;
...
}
on message * {
/* every time a message is received by our CAPL program node */
output(message);
}
This is a much easier way to set your message, compared to your solution: you no longer need to worry about this
The problem i face is in signal A and signal B, which are packed in one byte at location signal A: 1bit-28. signal B: 3bit-29 to 30.