Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Passing a Message object in a CAPL function to check data bytes.

Status
Not open for further replies.

r2msrit

Newbie level 2
Joined
Apr 3, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
23
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.
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:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top