hi
i found this on the siemens site
i know that is not exactly what u need but hope it will help
QUESTION:
How do I read write / write parameters using Profibus on the MICROMASTER 4?
ANSWER:
Following are a number of examples of how to read / write parameters:
Example 1: Read parameter P0700 (700 = 2BC (hex))
To read a parameter you should use the Task ID 1 "request parameter value". The Reply ID will be be either 1 or 2 (single or double word respectively) or 7 (error).
PROFIBUS => MICROMASTER : 12BC 0000 0000 0000, requests value of P0700
MICROMASTER => PROFIBUS : 12BC 0000 0000 0002, the reply tells us this is a single word with value 0002(hex)
Example 2: Read parameter P1082 (1082 = 43A (hex))
PROFIBUS => MICROMASTER : 143A 0000 0000 0000, requests value of P1082
MICROMASTER => PROFIBUS : 243A 0000 4248 0000, 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 the sign = 0, exponent = 84 (hex) = 132, and the mantissa (1).900000 = [1 + 9/16 + 0/256 + ...] giving (1) x (32) x (1.5625) = 50.00
Example 3: Read parameter P2000 (2000 = 000 (hex) and Bit 7 of IND)
To read a parameter between 2000 and 3999, you must set the PNU extension in the 2nd word (IND).
PROFIBUS => MICROMASTER : 1000 0080 0000 0000, requests value of P2000.
MICROMASTER => PROFIBUS : 2000 0080 4248 0000, the reply tells us this is a double word with value 4248 0000 (IEEE float value) i.e. 50.00
The above data is valid for cyclic communications.
If you are using acyclic communication, Bit 15 of IND is used for selecting parameters from P2000 to P3999; the sent and received data would then be:
PROFIBUS => MICROMASTER : 1000 8000 0000 0000
MICROMASTER => PROFIBUS : 2000 8000 4248 0000
Example 4: Read parameter P2010, index 1 (2010 = 00A and Bit 7 of IND)
This example shows the structure for cyclic communications. To read the value of a parameter index you must define the index in bits 0 to 7 of the 2nd PKW word (IND).
PROFIBUS => MICROMASTER : 100A 0180 0000 0000, requests value of P2010 index 1.
MICROMASTER => PROFIBUS : 100A 0180 0000 0006, the reply tells us this is a single word with value 6 (hex).
It would also be possible to use Task ID 6 here.
Example 5: Change the value of P1082 to 40.00 [RAM only]
To write to a parameter, you must know whether it has a single or double word parameter value and use the Task ID 2 or 3 appropriately. To find this out, you can first read the parameter value via PROFIBUS (the information is also available in the Parameter List):
a. Read value:
PROFIBUS => MICROMASTER : 143A 0000 0000 0000
MICROMASTER => PROFIBUS : 243A 0000 4248 0000, the Reply ID 2 shows us that this is a double word so we will need to use the Task ID 3 "change parameter value (double word) [RAM only]".
b. Change parameter value to 40.00 (= 4220 0000 (IEEE float value))
PROFIBUS => MICROMASTER : 343A 0000 4220 0000
MICROMASTER => PROFIBUS : 243A 0000 4220 0000, this confirms that the value has been changed.
Note: If you want the changed value to be stored in the EEPROM, the Task ID 13 (= D hex) should be used. This must not be done repetitively, as EEPROM damage can occur.
Example 6: Evaluating an error reply
Example 5 assumed the inverter was not running. If the correct change telegram is sent when the inverter is running, the inverter replies with Task Identifier 7 "cannot process request", because P1082 cannot be changed while the inverter is running. The error number is in the parameter value area PKE2.
PROFIBUS => MICROMASTER : 343A 0000 4220 0000
MICROMASTER => PROFIBUS : 743A 0000 0000 0011
The error number is 11 hex = 17 dec "converter status is not compatible with the received request".
Example 7: Set P0844 to 722.2 (844 = 34C hex , 722 = 2D2 hex)
This sets digital input 3 for OFF2 (coast stop). P0703 must be set to 99 (enable BiCo parameterisation, digital input 3) to make 722.2 an available value in P0844.
PROFIBUS => MICROMASTER : 334C 0000 02D2 0002
MICROMASTER => PROFIBUS : 234C 0000 02D2 0002