Constructing RawCAN frames

11 months 2 weeks ago #29534997 by Peter_Walton
To send 4-byte variable in a rawCAN frame doesn't each byte need to be separately entered as a payload byte? If you mask off 1 byte from the variable and assign it to a user variable for transfer to a payload byte don't you have the same problem? i.e. you've still got 4 bytes, but you only need 1? What should the process be please?

Please Log in or Create an account to join the conversation.

11 months 1 week ago - 11 months 1 week ago #29535002 by Athanasios
Hi Peter
see below an example of a code that I hope will clarify your question

dim BY[8] as integer
wait (500)
Variable=0xabcdef 'enter the hex value abcdef to the variable
can_id=0x601' enter as can id hex value 601
command=0x40' enter command hex value 40
Variable=Variable>>8 'right shift one byte

when I run the code I get from the can sniffer what you see at the attached file.
Attached you can find the code also in a .txt file

It is only the less significant byte that is send from the BY[x] variable
Does this reply to your question?

Please Log in or Create an account to join the conversation.

Time to create page: 0.084 seconds