How to manage variable types larger than 64 bits - Ethernet/IP

opineiro
2024-09-23
2024-09-23
  • opineiro - 2024-09-23

    Hi there,

    I have a Keyence bar code reader connected to my plc through Ethernet/IP.
    The Bar code is 20 digits long (like 30100790020493036016), the scanner reads it correctly (I can verify that through the keyence software) but when it sends it through ETH/IP, it doesn't fit into a 64 bit variable and it trunks the data.(I've tried ULINT and LWord without success).
    When I loaded the EDS file, the read variable was defined as a byte with 128 bits length, which is quite strange for me. (see attached picture)
    How do I manage this variable?
    Thanks!

     
  • ph0010421 - 2024-09-23

    My guess is that's a STRING, not an INT type.
    And it's 128 bytes, not bits

     

    Last edit: ph0010421 2024-09-23
  • opineiro - 2024-09-23

    Thanks, that's what I thought initially.
    The point is that I can't select a String type variable. See the attached image

     
  • ph0010421 - 2024-09-23

    So it's currently mapped to an array of BYTES? Can you create a UNION?

    TYPE sBytesString :
    UNION
        AsBytes: ARRAY[0..127] OF BYTE;
        AsString: STRING(128);
    END_UNION
    END_TYPE
    

    Map it to the bytes, read it in the STRING!

     
  • opineiro - 2024-09-23

    Thanks, I'm going to try it!

     
    πŸ‘
    1

Log in to post a comment.