Network Byte Orders

5 days ago
5 days ago
  • Inna

    Inna - 5 days ago

    We have a system with PLCs with different byte order conventions - little endian/big endian.
    I'm looking for Codesys routines for converting data between a host's internal representation and Network Byte Order(like htons() and ntohs()).

    Thanks in advance

  • MadsKaizer

    MadsKaizer - 5 days ago

    Scroll down to programming:

    You could use a struct "Union", in this example I always read out the real value in the code where I use the value, but I can switch around on the word0 and word1 when writing into the union from the MODBUS register.


    Last edit: MadsKaizer 5 days ago

Log in to post a comment.