Hello,
I'm currently working on a project that use CAN. I have to mimic an existing device to allow my project to dialogue with another device that I can't modify. For this purpose I have to send data in intel format (little endian).
My original data is an INT32 (signed). I need to send it over 4 bits in little endian format. I use FlexCAN_T4 from Tonton81, but with a Teensy 3.2.
Can someone point me to the most efficient way to do this ?
Datas are GPS positions, so for example : 441303 (for 44'13''03''') or -441303 (for -44'13''03''').
I use CAN 11Bits broadcast.
Currently I do this :
Thank you,
I'm currently working on a project that use CAN. I have to mimic an existing device to allow my project to dialogue with another device that I can't modify. For this purpose I have to send data in intel format (little endian).
My original data is an INT32 (signed). I need to send it over 4 bits in little endian format. I use FlexCAN_T4 from Tonton81, but with a Teensy 3.2.
Can someone point me to the most efficient way to do this ?
Datas are GPS positions, so for example : 441303 (for 44'13''03''') or -441303 (for -44'13''03''').
I use CAN 11Bits broadcast.
Currently I do this :
Code:
trame.buf[4] = CANlat & 0xff;
trame.buf[5] = (CANlat >> 8) & 0xff;
trame.buf[6] = (CANlat >> 16) & 0xff;
trame.buf[7] = (CANlat >> 24) & 0xff;
Thank you,
Last edited: