简体   繁体   English

将 J1939 消息转换为原始 CAN

[英]Convert J1939 message to raw CAN

I'm receiving J1939 CAN messages trough a class that uses IsoAgLib as framework.我通过使用 IsoAgLib 作为框架的 class 接收 J1939 CAN 消息。 On the receiver side I have these J1939 messages that need to get transmitted to the CAN network by using Qt's "QCanBusDevice" and "QCBusFrame".在接收端,我有这些 J1939 消息需要使用 Qt 的“QCanBusDevice”和“QCBusFrame”传输到 CAN 网络。

My question is: how can I convert a message in J1939 protocol to a raw can message and vice-versa?我的问题是:如何将 J1939 协议中的消息转换为原始罐消息,反之亦然?

J1939 is only a protocol layer, so you first need to create the CAN ID based on the priority, PGN and source address of the J1939 message, The CAN ID is 29bit length use the following structure as example: J1939只是一个协议层,所以首先需要根据J1939报文的优先级、PGN和源地址创建CAN ID,CAN ID为29bit长度,以如下结构为例:

-priority 0x18 - 优先级 0x18

-PGN 0xFECA -PGN 0xFECA

-Source address 0x00 - 源地址 0x00

The structure above it is an example of one of the J1939 messages ID, the raw ID will be the same 0x18FECA00.上面的结构是 J1939 消息 ID 之一的示例,原始 ID 将是相同的 0x18FECA00。 J1939 only dictates how to interpret the raw information. J1939 仅规定如何解释原始信息。

Now to assemble the payload will depends on the parameter length in bits, the start bit and the offset.现在组装有效载荷将取决于以位为单位的参数长度、起始位和偏移量。

-Identify the data length -assemble all the bytes according to the J1939 signal information You can find this on the SAE J1939-71 and SAE J1939-73 documents. - 识别数据长度 - 根据 J1939 信号信息组装所有字节 你可以在 SAE J1939-71 和 SAE J1939-73 文档中找到这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM