recvCANid := Message.udiCanID;
IF recvCANid = 16#18FF8247 THEN
UserVarGlobal.g_countMsg_RPMset := UserVarGlobal.g_countMsg_RPMset + 1;
FOR i := 0 TO 7 DO
myDataFF82[i] := Message.abyData[i];
END_FOR
END_IF
but in this way I can only display CAN messages which I know its ID.
I want to display all incoming CAN messages
for example
first incoming CAN message - I assign it into a variable Message1.
second incoming CAN message - I assign it into a variable Message2.
third incoming CAN message - I assign it into a variable Message3.
Can you give me guidance?
Thank you
BR
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
Im using CAN API
Im receiving CAN messages with no problem. below is my code.
METHOD ProcessMessage
VAR_IN_OUT
( Incoming message )
Message : CAN.RxMESSAGE;
END_VAR
VAR
i: USINT;
END_VAR
recvCANid := Message.udiCanID;
IF recvCANid = 16#18FF8247 THEN
UserVarGlobal.g_countMsg_RPMset := UserVarGlobal.g_countMsg_RPMset + 1;
FOR i := 0 TO 7 DO
myDataFF82[i] := Message.abyData[i];
END_FOR
END_IF
but in this way I can only display CAN messages which I know its ID.
I want to display all incoming CAN messages
for example
first incoming CAN message - I assign it into a variable Message1.
second incoming CAN message - I assign it into a variable Message2.
third incoming CAN message - I assign it into a variable Message3.
Can you give me guidance?
Thank you
BR
Create a (global) array of Messages:
aMessage : ARRAY[0..NR_OF_MESSAGES-1] OF CAN.RxMESSAGE;
Then add each received message to the array.
IF UserVarGlobal.g_countMsg_RPMset < NR_OF_MESSAGES THEN
aMessage[UserVarGlobal.g_countMsg_RPMset] := Message;
UserVarGlobal.g_countMsg_RPMset := UserVarGlobal.g_countMsg_RPMset + 1;
END_IF