SI-Ethernet User Guide
157
Issue: 3
Sa
fe
In
Me
ch
E
Get
ting s
ta
P
K
an
PC T
Sec
Di
G
Ind
ex
7.4.5
Reading the parameter value
The required parameter value is read from two signed 16-bit values, these two values must then
be correctly merged to form the correct 32-bit value.
Base a 5 (LSW)
The least significant word of the parameter value is read and converted from a signed 16-bit value
and stored in a 32-bit variable, this value is then bitwise ANDed with the hexadecimal value
0x0000FFFF.
If an error is indicated in the status value then this value will identify the cause of the error.
Base a 6 (MSW)
The most significant word of the parameter value is read and converted from a signed 16-bit value
and stored in a 32-bit variable by bitwise shifting it 16 places left and bitwise ANDing the result with
the hexadecimal value 0x0000FFFF.
The actual value is then calculated by bitwise ORing the two words together.
If the source parameter was a 16-bit parameter and the most significant bit (b15) was set to 1
(indicating a negative number) then the decimal value 65536 is subtracted.
As an example, the following code may be used in the user program:
// Read complete
// Get the LSW value
Address% = BaseAddress% + 5
LSW% = #Address%
// Get the MSW value
Address% = BaseAddress% + 6
MSW% = #Address%
Value% = (LSW% & 0x0000FFFF) | ((MSW% << 16) & 0xFFFF0000)
// Correct for 16bit -ive values
IF
Bit32% = 0
THEN
// 16 bit
IF
Value%.15 = 1
THEN
// Correct for negative number
Value% = Value% - 65536
ENDIF
ENDIF
BaseAddress% is the parameter specified in
S.02.036.
Bit32% specifies the source parameter as 16-bit or 32-bit (0 = 16-bit. 1 = 32-bit).
NOTE
Содержание Unidrive M600
Страница 1: ...User Guide SI Ethernet and Unidrive M Onboard Ethernet Part Number 0478 0137 03 Issue 3 ...
Страница 16: ...16 SI Ethernet User Guide Issue 3 Figure 4 3 Typical network topologies ...
Страница 215: ......
Страница 216: ...0478 0137 03 ...