Canbus Sniffing as slave

Hi All!

I have Two X90CP154-S1 PLCs. I connected one sensor via Canopen to the PLC1 and I am getting the data very well.

Now I want to sniff this bus by PLC2 . I connected the wires, and turned off the CAN on PLC2 and put this code but not works.

fbCanReceive.DeviceName := ‘IF8’;
fbCanReceive.Enable := enableScan;
fbCanReceive();

IF (fbCanReceive.Active AND fbCanReceive.NewDataValid) THEN

	CASE fbCanReceive.ReceivedFrame.ID OF
    
		16#18A: 
		Sensor10.Axis_X16 := BYTE_TO_DINT(fbCanReceive.ReceivedFrame.Data[0]) + 
		SHL(BYTE_TO_DINT(fbCanReceive.ReceivedFrame.Data[1]), 8);
		Sensor10.Axis_Y16 := BYTE_TO_DINT(fbCanReceive.ReceivedFrame.Data[2]) + 
		SHL(BYTE_TO_DINT(fbCanReceive.ReceivedFrame.Data[3]), 8);

The active is false and the busy is blinking true/ false. and StatusIs is -1070584145.

Thanks

Hi,

based on the naming of the function block outputs it looks like you’re using ArCanReceive() (?)

-1070584145 means ‘invalid ID’. According to help this function block is not the source of this error.

But in case the online help is not complete: what .ID and .IDMask and .Format are you using ?

HI @Saeed_Rostami , what is status of your topic, can you update us?

Hi All!

1-I used the sensor node ID for both PLCs but as I said I could not get the data by PLC2.

2-I did another test I just used EDS file for both PLCs and without any code just by HW configuration, both PLCs listen to the bus and getting data from sensor surprisingly!!!

I wanted to share with you, apparently when a sensor is putting data on the bus no need to write the codes just by IO mapping you can read the data!

Thanks

1 Like