RobotStudio event

Ethernet/IP Byte Order Issue

I'm setting up communication between an Ethernet/IP device and an OmniCore C30 controller via IO Engineer in RobotStudio, and I'm running into an issue with formatting an unsigned 32 bit integer.  

I'm receiving 6 bytes of process data via an Ethernet/IP connection from an IO Link Master.  4 of these bytes should be an unsigned 32 bit integer.  When I assign the appropriate bit range as an analog input, I receive the incorrect value.  I tried adjusting the endianness and unsigned vs 2sC, but no dice.  Interestingly, when I convert the decimal number I’m getting in the analog input to binary, and compare it to the binary of the number I should be receiving, the words have been swapped.  So byte 0 and 1 should be swapped with byte 2 and 3, and vice versa. Is there a word swap (not a byte swap) that I can use to correctly format the bytes within the 32 bit integer?  
Tagged:

Answers

  • lemster68
    lemster68 ✭✭✭
    edited October 28
    You could try mapping them in a different order.  They do not have to be continuous bits.  From the Technical reference manual, System parameters:

    Examples of valid mapping of an analog or group signal (2-32 bits):
    • 4, 6-7
    • 16-31
    • 8-15, 0-7

    One caution, ensure that your bit mapping in this way does not cross byte boundaries, e.g., 14-21.  
    Post edited by lemster68 on
    Lee Justice
  • Thanks for the help, that worked!  I didn't realize you could map bits non continuously. 
  • lemster68
    lemster68 ✭✭✭
    Great!  You are welcome. 👍
    Lee Justice