• AVR Freaks

MODBUS String data transfer

Author
luciano.magini
New Member
  • Total Posts : 27
  • Reward points : 0
  • Joined: 2015/09/18 07:03:48
  • Location: Roma, IT
  • Status: offline
2018/08/28 05:45:56 (permalink)
0

MODBUS String data transfer

Hi,
i'm new to MODBUS; I've implemented a MODBUS TCP server and i think i will need to transmit to a master device some string data.
I think i will use the multiple register (read-only or read/write) read command, but i have some doubts.
The MODBUS transmits 16 bit long registers in big-endian format. if i write the "test" text in a string, for instance, i will have my bytes in this order:
byte 0: 't';
byte 1: 'e';
byte 2: 's';
byte 3: 't'.
 
so the fist 16 bits word contains the values 't' (LSByte) and 'e' (MSByte) and the second 16 contains 's' (LSByte) and 't' (MSByte).
 
If the master initiates a multiple registers read, by reading these two words, because the data field is big-endian formatted, the string will arrived in this order:
byte 1: 'e';
byte 0: 't';
byte 3: 't';
byte 2: 's'.
 
The same thing should happen when i have to transmit a data bigger then a 16 bits word, like a 32 bits integer or a floating point variable.
 
Is that right?
#1

6 Replies Related Threads

    Jim Nickerson
    User 452
    • Total Posts : 6333
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: MODBUS String data transfer 2018/08/28 06:03:30 (permalink)
    0
    Do try the code and tell us what happens.
    #2
    luciano.magini
    New Member
    • Total Posts : 27
    • Reward points : 0
    • Joined: 2015/09/18 07:03:48
    • Location: Roma, IT
    • Status: offline
    Re: MODBUS String data transfer 2018/08/28 06:12:48 (permalink)
    0
    To try it, i need a MODBUS software tool, which show the received data as a string. I haven't found a software like that.
    I should write a test software by myself, but I would not get any results.
    #3
    Jim Nickerson
    User 452
    • Total Posts : 6333
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: MODBUS String data transfer 2018/08/28 06:15:47 (permalink)
    0
    Do you have any ModBus device to exchange messages with ?
    #4
    luciano.magini
    New Member
    • Total Posts : 27
    • Reward points : 0
    • Joined: 2015/09/18 07:03:48
    • Location: Roma, IT
    • Status: offline
    Re: MODBUS String data transfer 2018/08/28 06:23:25 (permalink)
    0
    No, I haven't, because this is my first approach to this protocol, and i'm defining the provisional memory map of my slave device, and then we will propose that to our customer. But I still don't know how the master device works.
     
    #5
    Jim Nickerson
    User 452
    • Total Posts : 6333
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: MODBUS String data transfer 2018/08/28 06:29:14 (permalink)
    +1 (1)
    I suggest you google "open source Modbus simulator".
    At least you will have something to exchange messages with.
    It is a very difficult task to do it theoretically on paper with no actual device to test with.
    #6
    luciano.magini
    New Member
    • Total Posts : 27
    • Reward points : 0
    • Joined: 2015/09/18 07:03:48
    • Location: Roma, IT
    • Status: offline
    Re: MODBUS String data transfer 2018/08/28 06:38:43 (permalink)
    0
    I will look for it!
    Thank you
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5