r2msrit
Newbie level 2
I have some messages that appear to CAN 3. Now I want to check the data bytes content of these messages every time they arrive.
I was wondering can we make a function that accepts a message object and returns 1 or 0 on success and failure respectively. Is this possible , if so , please let me know. . I have a code here . The data values that I have passed in the argument are same as that I see on the trace, still it does not work
Please help.
Thanks in Advance.
I was wondering can we make a function that accepts a message object and returns 1 or 0 on success and failure respectively. Is this possible , if so , please let me know. . I have a code here . The data values that I have passed in the argument are same as that I see on the trace, still it does not work
Please help.
Thanks in Advance.
Code:
variables
{
message x789 msg_789_500ms;
message x788 msg_788_100ms;
message ..
.
..
....
message x980 msg_980_100ms;
}
on message CAN3.*
{
if(isStdId(msg_789_500ms))
{
if(Check_Created_Msg_Data_IPC(msg_789_500ms,0x00,0x00,0x00,0x06,0xA0,0x00,0x00,0x00))
{
write("789 Contains Correct Data According to Specification \n");
}
else
{
write("789 Contains INCorrect Data According to Specification \n");
}
}
else{write("789 NOT found on CAN 3 \n"); }
}
int Check_Created_Msg_Data_IPC(message * msg, byte byte_0, byte byte_1, byte byte_2, byte byte_3, byte byte_4, byte byte_5, byte byte_6, byte byte_7 )
{
if(
(msg.byte(0)== byte_0)&&
(msg.byte(1)== byte_1)&&
(msg.byte(2)== byte_2)&&
(msg.byte(3)== byte_3)&&
(msg.byte(4)== byte_4)&&
(msg.byte(5)== byte_5)&&
(msg.byte(6)== byte_6)&&
(msg.byte(7)== byte_7)
)
{
return 1;
}
else
{
return 0;
}
}
Last edited by a moderator: