,QWHUQDWLRQDO(QJOLVK &20081,&$7,216
MICROMASTER 420 Reference Manual
Issue A1
49
3.3.5 PKW Examples:
Reading and writing parameter values:
It is always possible to use a 4 word PKW in the master even when P2013 =127=
variable length. For the examples this will always be used and will be shown in
hexadecimal format. The reply PKW telegram will either be 3 or 4 words long
depending on the parameter value type.
5HDGDSDUDPHWHUYDOXHZLWKSDUDPHWHUQXPEHUEHWZHHQDQG
To read a parameter you should use the Task ID 1 "request parameter value". The
Reply ID will be either 1 or 2 (single or double word respectively) or 7 (error).
([DPSOH
Read parameter P0700. (700 = 2BC (hex))
866→0,&520$67(5%&
requests value of P0700.
0,&520$67(5→866%&
the reply tells us this is a single word with
value 0002 (hex).
([DPSOH
Read parameter P1082. (1082 = 43A (hex))
866→0,&520$67(5$
requests value of P1082.
0,&520$67(5→866$
the reply tells us this is a double word
with value 4248 0000 (IEEE float value).
The IEEE float format is as follows:
Bit 31 = sign,
Bit 23 to Bit 30 = exponent and
Bit 0 to Bit 22 = mantissa,
with the decimal value being given by:
value = ((-1) to power of sign)
x (2 to power of (exponent - 127))
x 1.Mantissa).
For this example:
sign = 0,
exponent = 84 (hex) = 132
mantissa (1).900000 = [1 + 9/16 + 0/256...]
giving (1)x(32)x(1.5625) = 50.00.
5HDGDSDUDPHWHUYDOXHZLWKSDUDPHWHUQXPEHUEHWZHHQDQG
To read a parameter between 2000 and 3999, you must set the PNU extension in
the 2nd word (IND).
866→0,&520$67(5
requests value of P2000.
0,&520$67(5→866
the reply tells us this is a double word
with value 4248 0000 (IEEE float value)
i.e. 50.00.