Ethernet/IP Byte Order Issue
                
                    avanpelt                
                
                     ✭                
            
                        
                
                                    
                                  in RobotStudio             
            
                    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?
                        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:
            
        
0  
            Answers
- 
            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 onLee Justice1 - 
            Thanks for the help, that worked! I didn't realize you could map bits non continuously.0
 - 
            Great! You are welcome. 👍Lee Justice0
 
Categories
- All Categories
 - 5.6K RobotStudio
 - 401 UpFeed
 - 21 Tutorials
 - 15 RobotApps
 - 306 PowerPacs
 - 407 RobotStudio S4
 - 1.8K Developer Tools
 - 250 ScreenMaker
 - 2.9K Robot Controller
 - 363 IRC5
 - 81 OmniCore
 - 8 RCS (Realistic Controller Simulation)
 - 853 RAPID Programming
 - 31 AppStudio
 - 4 RobotStudio AR Viewer
 - 19 Wizard Easy Programming
 - 110 Collaborative Robots
 - 5 Job listings
 
