利用CAPL与CANoe结合,在CAN上通过ISO传输大量数据.是否有一个例程,提供对嵌入在CAPL中的数据分段的处理,还是我需要自己编写解释?
发布于 2016-02-26 13:33:12
看看OSEK_TP CANoe演示。它展示了如何在ISO (传输协议,ISO 15765-2)上传输和接收数据.有关实现细节,请参阅nodeA.can文件和OSEL_TP API引用。
下面是最小的例子:
创建和配置连接:
long handle;
handle = CanTpCreateConnection(0); // 0 = Normal mode
CanTpSetTxIdentifier(handle, 0x700); // Tx CAN-ID
CanTpSetRxIdentifier(handle, 0x708); // Rx CAN-ID发送数据:
BYTE data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
CanTpSendData(handle, data, elcount(data));要接收数据,必须实现以下回调函数:
void CanTp_ReceptionInd(long connHandle, byte data[])
{
write("Received %d byte on connection %d: [%02x] ...",
elcount(data), connHandle, data[0]);
}https://stackoverflow.com/questions/35626632
复制相似问题