This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data storage format

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.

Parents
  • This now has absolutely nothing to do with your original question, which was about the ordering of the bytes within 16-bit, 32-bit and larger variables.

    "So how can I make conversion for every different message?"

    Every protocol stack must have the ablity to build and decode every single message type defined by the protocol!

    You said your code was working before - just that the individual bytes within 16-bit, 32-bit and larger variables were in the wrong order.

    If your code was working before, then it must already have the means to build & decode messages - all you need to do is fix the parts where it takes individual bytes from larger variables - the rest of it must be OK!

Reply
  • This now has absolutely nothing to do with your original question, which was about the ordering of the bytes within 16-bit, 32-bit and larger variables.

    "So how can I make conversion for every different message?"

    Every protocol stack must have the ablity to build and decode every single message type defined by the protocol!

    You said your code was working before - just that the individual bytes within 16-bit, 32-bit and larger variables were in the wrong order.

    If your code was working before, then it must already have the means to build & decode messages - all you need to do is fix the parts where it takes individual bytes from larger variables - the rest of it must be OK!

Children
  • "how can I make conversion for every different message?"

    Handling messages is what a protocol stack does!

    You didn't answer the question: are you writing this stack yourself, or have you purchased it from a supplier?

    If it's a purchased product, you need to contact the supplier's technical support for details of how to configure it to work with Keil tools.