SENCANMESSAGE - STRUGGLE

Discuss issues and ideas you have to configuring displays with PowerVision
mcg2068
Posts: 10
Joined: Thu Mar 10, 2016 8:20 pm

SENCANMESSAGE - STRUGGLE

Post by mcg2068 » Thu Sep 08, 2016 8:16 pm

I used the sample code below, from this forum to send a can message (PV450)
The result is that a message is send (good) to PGN 03400 (?)

Question: I like to send a message with for example PGN 0AAAA. How/where to define the PGN?

Thanks


//---------------------------------------------------------------------------------------------
// Murphy Scripting
// - Leave EventName as $SendCANMessage$ for main script method
//---------------------------------------------------------------------------------------------
void $SendCANMessage$ ()
{
CANMessageInfo info;
info.MessageType = CANMessageInfoType.SinglePacketRaw;
info.DestinationAddress = 0xFF;
info.RtsCtsMaxPackets = 0xFF;

CANMessageBuffer buffer;

buffer.CanID = 0x12345678;
buffer.Size = 8;
buffer.WriteInt8(0, 0xFF);
buffer.WriteInt8(1, 1);
buffer.WriteInt8(2, 2);
buffer.WriteInt8(3, 3);
buffer.WriteInt8(4, 4);
buffer.WriteInt8(5, 5);
buffer.WriteInt8(6, 6);
buffer.WriteInt8(7, 7);
buffer.WriteInt8(8, 8);
buffer.WriteInt8(9, 9);

int port = 0;
SendCANMessage(0, buffer, info);

}
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: SENCANMESSAGE - STRUGGLE

Post by stalley » Fri Sep 09, 2016 3:54 pm

Hello mcg2068,

The CanID member of the CANMessageBuffer is where the PGN would be set. It will depend on the MessageType member in the CANMessageInfo object whether the CanID will be a 29-bit Identifier or an 11-bit Identifier.

In your example below, you set the MessageType to be CANMessageInfoType.SinglePacketRaw, which is an extended frame format. The CanID will be a 29-Bit Identifier :

buffer.CanID = 0x18AAAAF2

which sets the Priority to 6, PGN to AAAA and the Source Address to F2.

The CanID member will be the 29-bit Identifier, unless you choose StandardFrame for the MessageType in your CANMessageInfo variable, in which case it will be an 11-bit Identifier.

Best Regards,
Sara Talley
Software Engineer
Enovation Controls
mcg2068
Posts: 10
Joined: Thu Mar 10, 2016 8:20 pm

Re: SENCANMESSAGE - STRUGGLE

Post by mcg2068 » Sat Sep 10, 2016 9:35 pm

Thank you Sara. I could not wait to monday to try.
It could not be that easy as my original Canbuff.id = 0x12345678 returned 3400 . If it had returned 3456, I would have guessed it and tried it.

I tried as you suggested: (FE instead of F2)

CANMessageBuffer buffer;

buffer.CanID = 0x18AAAAFE;
buffer.Size = 8;
buffer.WriteInt8(0, 0xFF);
buffer.WriteInt8(1, 1);

It returned
18AAAAFE
P = 6 / PGN = 0AA00 / SA = FE / DA = AA / FLG = <empty> / LEN = 8 / D0 = FF / D1 = 01 / ....................................... etc.
153456F2
P = 5 / PGN = 13400 / SA = F2 / DA = 56 / FLG = <empty> / LEN = 8 / D0 = FF / D1 = 01 / ....................................... etc.
12345678
P = 4 / PGN = 03400 / SA = 78 / DA = 56 / FLG = <empty> / LEN = 8 / D0 = FF / D1 = 01 / ....................................... etc.

Considering the id = 0x12345678
12 > P=4 and probably influence the first number of PGN 03400
34> are the 2nd and 3rd number of the PGN 03400
56> DA
78> SA

Where the 00 in the PGN 03400 comes from?

Can not wait till monday 8-)

STRUGGLING ON - WE WILL GET THERE

Question remain; How to send PGN 0AAAA ?
mcg2068
Posts: 10
Joined: Thu Mar 10, 2016 8:20 pm

Re: SENCANMESSAGE - STRUGGLE

Post by mcg2068 » Mon Sep 12, 2016 1:38 am

NOTE TO ME:

0x 18AAAAFE‬

‭32 BIT
0001 1000/ 1010 1010 / 1010 1010 / 1111 1110‬

Buffer.CanID = 29 bit therefore first 000 no use

29 BIT
1 10 / 0 / 0 / 1010 1010 / 1010 1010 / 1111 1110

Priority (3bit) 110 = 6‬
Etended Datapage 0 = 0
Datapage 0 = 0
PDU format 1010 1010 = AA
PDU Specific 1010 1010 = AA
Source address 1111 1110 = FE


PGN SHOULD HAVE BEEN 0x 0AAAA
boyce
Enovation Controls Development
Enovation Controls Development
Posts: 322
Joined: Wed Sep 08, 2010 5:09 pm

Re: SENCANMESSAGE - STRUGGLE

Post by boyce » Mon Sep 12, 2016 9:57 am

Hello mcg2068,

I'll jump in here because Sara is out of the office on a business trip.

Using an ID like 18AAAAFE as an example the PDU is in the PDU1 format because the PF is AA (decimal 170 is 0 to 239) and therefore the PS is a Destination Address. So that looks correct the PGN is 0AA00 and the DA (Destination Address) is AA.

If PF is 240 to 255 (F0 to FF hex) the PDU would be the PDU2 Group Extension format where it looks like a 2 byte PGN.

Hope this helps.
Boyce
Boyce Schrack
Enovation Controls
mcg2068
Posts: 10
Joined: Thu Mar 10, 2016 8:20 pm

Re: SENCANMESSAGE - STRUGGLE

Post by mcg2068 » Fri Sep 16, 2016 5:54 am

Boyce, Sara,

What you wrote is correct. It also appears to be the same for a free form numeric message
with an "extended frame send"

It is not what I hoped for and I must do something wrong.

To communicate between a display and micro controller i like to send messages with my own designated PGN. For example 1000 ~ 2000 if they would not conflict with other PGN.

I also tried to play with "standard frame send" - 8-( unfortunately I got no output message at all.

Could you post a sample for a PV450 sending a PGN 01000 message to all (FF).
(I did not manage to get the older samples to work in 2.8)

If it is not the same ,how to send a "standard frame message"

I considered that my canbus reader might be wrong. However messages from other devices read out correctly. 8-(


Kind regards
Marc
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: SENCANMESSAGE - STRUGGLE

Post by stalley » Fri Sep 16, 2016 5:00 pm

Hello Marc,

I would recommend getting the SAE J1939 specifications, in particular the J1939-21 which describes the 29-bit identifier, fields in it and how they are used. I find I use the 21, 71 and 73 specifications the most. The 81 is helpful also because it describes the Address Claim.

It is great that you are trying different things, I like to break things also, then I know how they work. The specs will help to understand why they work and don't work.

I'm not sure what examples you are using. I'm attaching a demo config that sends several different message type from a script. It isn't very neat, but hopefully it has the information that will help you. I think the first message is close to what you are looking for.
J1939Message_MessageTypes - mcg.zip
(692.85 KiB) Downloaded 27 times
Let me know how your experiment works.
Sara Talley
Software Engineer
Enovation Controls