EasyManua.ls Logo

Emerson Unidrive M201 - Page 140

Emerson Unidrive M201
198 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
140 SI-Ethernet User Guide
Issue: 1
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:
// 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 THEN
// Subtract 65536
WWWXXX% = WWWXXX% - 65536
ENDIF
IF YYYZZZ% > 32767 THEN
// Subtract 65536
YYYZZZ% = YYYZZZ% - 65536
ENDIF

Table of Contents

Other manuals for Emerson Unidrive M201

Related product manuals