Hello, I'm developing a DeviceNet application with Silicon Labs C8051F040, Keil compiler and a DeviceNet stack. The problem is the way that Keil stores var (16bit, 32 bit...). When I send data on the DeviceNet, the other devices get the inversion of my data. For example, if i want to send 0x123456, the others Device, such as my computer, receive 0x563412. Is there any way to solve this problem? Please don't tell me to convert the data into 8bit length because that is a very huge work (I'm using the DeviceNet stack of other company). Thanks for reading this topic.
The sender and receiver have to know the message format to communicate at all. At the very least, it has to be parsable based on the early fields. If you know you have a 2-byte field, followed by a 6-byte field, then you can declare something like:
typedef struct { U16 msgType; U8 MacAddr[6]; } MyMessage;