Author Topic: Transmitting 16bit J1939 CAN message  (Read 8964 times)

Offline llang

  • PLUS+1 User
  • **
  • Posts: 7
  • Karma: +0/-0
Transmitting 16bit J1939 CAN message
« on: March 15, 2024, 12:27:33 PM »
Hello PLUS+1 community,
i want to implement a automatic start/stop function with a Danfoss M024.
I use the J1939 standard and need to send PGN61677 with SPN7745 and data content 10b(hex).

Therefore I used the PGN_Tx1 component from the J1939 Libary. The problem is that if I understand correctly the hexadecimal number must be converted into binary which is 100001011(bin). The length of 9 bits is too long for the TX component's data input which requires an array of 8 bits length.
Is this even correct to convert in to binary?


I'm relatively new to GUIDE programming so any help is greatly appreciated. :)

I attached a jpg with my code block.
Thanks!

Offline Lukey

  • PLUS+1 Expert
  • ****
  • Posts: 71
  • Karma: +8/-0
Re: Transmitting 16bit J1939 CAN message
« Reply #1 on: March 15, 2024, 03:06:01 PM »
Hi llang, I'm not sure how you determined 9 bits length, the overall length should be 8 bytes.

See below of example for an engine simulator I have that sends to PGN 61444 Electronic Engine Controller 1 random RPM/Speed message.

You need to find a breakdown of the PGN, that will tell you your SPN start position in the 8 bytes and the length of the message;
example her for PGN 61444 https://www.simmasoftware.com/products/j1939/j1939-pgn/


Offline llang

  • PLUS+1 User
  • **
  • Posts: 7
  • Karma: +0/-0
Re: Transmitting 16bit J1939 CAN message
« Reply #2 on: March 15, 2024, 09:50:24 PM »
Hi Lukey,

thank you for your answer. I thought that I have to convert the hex code into bin which has 9 digits (therefore 16 bytes needed), which is wrong i guess.

I can give you an extract from the PGN document. Could you please explain, how I can send e.g. "10b Start requested, automatic type"? Can i just put the hex code into an encode function?

Thanks in advance. :)

Best regards, Lukas
« Last Edit: March 15, 2024, 10:32:05 PM by llang »

Offline Lukey

  • PLUS+1 Expert
  • ****
  • Posts: 71
  • Karma: +8/-0
Re: Transmitting 16bit J1939 CAN message
« Reply #3 on: March 15, 2024, 11:06:03 PM »
I think you want something like this, but best to test it to be sure.

Assuming you would want to set the 1st bit to False when wanting to switch engine off.

Offline llang

  • PLUS+1 User
  • **
  • Posts: 7
  • Karma: +0/-0
Re: Transmitting 16bit J1939 CAN message
« Reply #4 on: March 18, 2024, 07:14:33 AM »
Thank you.

In the encode block you set the first input to true - this must be the "01b = Start requested, operator type".
So if i want e.g. "10b = Start requested, automatic type" I have to set the second input to true and the first to false?

Offline Lukey

  • PLUS+1 Expert
  • ****
  • Posts: 71
  • Karma: +8/-0
Re: Transmitting 16bit J1939 CAN message
« Reply #5 on: March 18, 2024, 11:19:39 AM »
I interpreted the information you provided left to right I.e. 1st bit then 2nd bit, so as how I programmed "10b = Start requested, automatic type"

I might be wrong, best to test in real time to be sure.