Emerson Unidrive M700 User Manual page 140

Si-ethernet and unidrive m - onboard ethernet
Hide thumbs Also See for Unidrive M700:
Table of Contents

Advertisement

7.4.1
Setting the destination node IP address
When setting the destination node IP address parameters, each parameter contains two
octets of the IP address. i.e. the most significant two octets (www.xxx) of the IP address
is written to the base address + 1 parameter and the least significant two octets
(yyy.zzz) of the IP address is written to the base address + 2 parameter.
Because each octet is an unsigned byte and the parameter used to store the combined
value is a signed 16-bit parameter, the following sequence must be used:
Base address + 1 (www.xxx)
1. "www" – bit shift left 8 times, clear upper 16 bits and lower 8 bits
2. "xxx" – clear upper 24 bits
3. Bitwise OR the two values
4. Correct the result for negative value
Base address + 2 (yyy.zzz)
1. "yyy" – bit shift left 8 times, clear upper 16 bits and lower 8 bits
2. "zzz" – clear upper 24 bits
3. Bitwise OR the two values
4. Correct the result for negative value
As an example, the following code may be used in the user program:
140
// Set the IP address
WWWXXX% = ((www% << 8) & 0x0000FF00) | (xxx% & 0x000000FF)
YYYZZZ% = ((yyy% << 8) & 0x0000FF00) | (zzz% & 0x000000FF)
// Handle the casting from 32bit variable to 16bit parameter
IF
WWWXXX% > 32767
// Subtract 65536
WWWXXX% = WWWXXX% - 65536
ENDIF
IF
YYYZZZ% > 32767
// Subtract 65536
YYYZZZ% = YYYZZZ% - 65536
ENDIF
THEN
THEN
SI-Ethernet User Guide
Issue: 1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents