X90 - 4PPC CAN J1939 Comunnicatio

,

Hey my name is Kylian,

“I’m on my last year for a national higher diploma, working on my final project. I’m pretty new to industrial programming and hardware, so I’m having trouble getting it done and the deadline is approaching menacingly. Currently, I am trying to make an X90 and a 4PPC communicate via J1939 CAN bus, but I really can’t get it working properly despite all the documentation. I know Automation Studio is set up properly since I could push some visuals on the 6PFT50 piloting the X90. There is some code left from last year’s students, but I really can’t understand it and it doesn’t seem to emit anything. When reading the CAN bus, nothing pops up.”

Thanks in advance, Kylian.

Here is the code left

//Send Data
PROGRAM _INIT
	// Initialisation des variables
	FOR i:= 0 TO 13 DO
		ArCanSenderMotor[i].DeviceName := 'IF7';
		ArCanSenderMotor[i].Enable := TRUE;
		ArCanSenderMotor[i].SendFrame := TRUE;
	END_FOR;
	FOR j:= 0 TO 2 DO
		ArCanSenderSPU[j].DeviceName := 'IF7';
		ArCanSenderSPU[j].Enable := TRUE;
		ArCanSenderSPU[j].SendFrame := TRUE;
	END_FOR;
END_PROGRAM

// Programme
PROGRAM _CYCLIC
	
	FOR i:= 0 TO 13 DO
		ArCanSenderMotor[i].Frame := Motor_0x00[i].Frame;
		ArCanSenderMotor[i]();
	END_FOR;
	FOR j:= 0 TO 2 DO
		ArCanSenderSPU[j].Frame := SPU_0x21[j].Frame;
		ArCanSenderSPU[j]();
	END_FOR;

END_PROGRAM
//Receive Data
PROGRAM _INIT
	ArCanReceiver[0].ID := 16#18FF2017;
	ArCanReceiver[1].ID := 16#18FEDA17;
	ArCanReceiver[2].ID := 16#18FEEB17;
	ArCanReceiver[3].ID := 16#18FEFC17;
	ArCanReceiver[4].ID := 16#18FF1017;
	ArCanReceiver[5].ID := 16#18E00017;
	FOR k:= 0 TO 5 DO
		ArCanReceiver[k].DeviceName := 'IF7';
		ArCanReceiver[k].Enable := TRUE;
		ArCanReceiver[k].Format := arCAN_29BIT;
		ArCanReceiver[k].IDMask := arCAN_RECEIVE_SINGLE_ID;
		ArCanReceiver[k].QueueSize := 128;
	END_FOR;
END_PROGRAM

PROGRAM _CYCLIC
	FOR k:=0 TO 5 DO
		ArCanReceiver[k]();
		HMI_0x17[k].Frame := ArCanReceiver[k].ReceivedFrame;		
	END_FOR;
	
END_PROGRAM

Hello Kylian,

are you getting an error message from the function blocks? ArCanReceive()

Regards

Stephan

Hey Stephan thanks for the quick response,

As i opened the program with Watch the StatusID for the 3 first entries of ArCanSenderSPU are at “-1070584146” with ERROR set to true

Please check the wiring. You must connect CAN Low to CAN Low and CAN High to CAN High. You should also have a 120-ohm resistor between CAN High and CAN Low at the cable ends. Some interface cards also allow you to activate the terminating resistor.

1 Like

hey thanks stephan,

turns out the transistor i used at the other end of the bus was burnt, everything works impeccably now :smiley:

my bestest regards,