Network Byte Orders

Inna
5 days ago
5 days ago
  • Inna

    Inna - 5 days ago

    Hello,
    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: https://disorder.dk/wonderware/2020/10/07/modbus-tcp-between-codesys-controllers/

    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.