Microchip
直播中

王聪

7年用户 208经验值
私信 关注
[问答]

ECAN PIC24EP512GU810无法单独发送每个字节

你好,我用的是CAN模块。我用微芯片提供的程序作为基础。我的问题是:在一个CAN帧传输中,8个数据字节被组合成2到2。因此,为了发送下面的8个字节:0x1、0x2、0x、3、0x4、0x5、0x6、0x7,我们得到DATA1= 0x0102、DATA2= 0x0304、DAT。A3= 0x0506,DATA4= 0x0708。我无法单独发送每个字节。根据ECAN P34的数据表,我开始怀疑这是否可能。我希望我已经明确了我想做的事。问候,巴普蒂斯特。

以上来自于百度翻译


      以下为原文

    Hi,
I use the CAN module available.
I used the program provided by microchip as a basis.
My problem is as follows: during a CAN frame transmission, the 8 data bytes are combined 2 to 2.
Thus, to send the following 8 bytes: 0x1, 0x2, 0x, 3, 0x4, 0x5, 0x6, 0x7
We obtain Data1 = 0x0102, Data2 = 0x0304, Data3 = 0x0506, Data4 = 0x0708.

I can't manage to sent each byte separately.
According to the datasheet about ECAN p34, I'm beginning to wonder if this is possible.

I hope I have been clear in what I want to do.

Regards,
Baptiste

回帖(3)

李兆峰

2019-2-20 16:01:13
嗯,你必须编4个16位字来代表你的8个字节…它们会被传送(根据DLC字段,当然)。这是可行的:你觉得奇怪的是什么?

以上来自于百度翻译


      以下为原文

    Mmmm, you must make up 4 16bits words that represent your 8 bytes... and they will be transmitted (according to the DLC field, of course).
 
This does work: what is strange in your opinion?
举报

肖锋

2019-2-20 16:09:39
你好,CinziaG,谢谢你的回复。我能做到这一点,我想要的是把我的功能放在8个字的8位。我将使用ISO 15765-2(传输层),数据在1字节上编码。我的英语不是很好…我不确定要明确,最好的问候,巴普蒂斯特

以上来自于百度翻译


      以下为原文

    Hi CinziaG,
 
Thank you for your reply.
I can do this, what I want is put in my function 8 words of 8 bits.
I'll use ISO 15765-2 (Transport Layer) where Data are coding on 1 byte.

My english is not very good ... i'm not sure to be explicit.

Best regards,
Baptiste
举报

李兆峰

2019-2-20 16:26:33
是的,你必须把8个字节放入4个单词中,“打包”它们…当然,你只会填充足够多的单词,如你所拥有的许多字节/ 2。

以上来自于百度翻译


      以下为原文

    Yes
you have to put the 8 bytes into those 4 words, "packing" them...
of course you will only fill enough words as many bytes /2 you have.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分