Demand Data 2408
f
& 2404
f
PROFIBUS Communications Handbook
7-4 2408
f
& 2404
f
PROFIBUS Communications Handbook
Worked example 1 - Starting an Autotune
An autotune is a good example of an operation that might be performed using the demand data sub-protocol, since it is a
relatively infrequent operation and it would be wasteful to dedicate PROFIBUS-DP I/O data to such a task.
Request 1: Clear any previous demand data requests. You should do this at the start of any sequence of operations using
demand data in order to ensure that the system is properly initialised.
PLC Output Register Number Output Data Comment
10
2 Anything
3 Anything
4 Anything
Response 1: Wait until the following response message is received in the input data:
PLC Input Register Number Input Data Comment
10
2 Anything
3 Anything
4 Anything
Request 2: Write 1 to Autotune enable. Note Tag address is 270 (decimal) see ‘TAG ADDRESSES’ Chapter 8
PLC Output Register Number Output Data Comment
1 8462 Write request 2000 (hex) (8192 dec) + tag address 270 (dec.) = 8462 (dec)
2 Anything
3 Anything
4 1 Write state 1 to enable Autotune see enumerators for each tag address in
Chapter 8
Response 2: Wait for one of the following responses to be received.
a. An error has occurred (Code 7)
PLC Input Register Number Input Data Comment
1 28942 Error 7000 (Hex) (28672 dec) + tag address (270 dec) = 28942
2 Anything
3 Anything
4 1 or
2 or
3
Invalid tag number
Read only parameter
Value out of range
b. No error
PLC Input Register Number Input Data Comment
1 4366 Successful write code 1000 (Hex) (4096dec) + tag address 270 (decimal)
= 4366
2 Anything
3 Anything
4 Anything
Request 3: If there was no error, poll Control Status Word (tag 76) until autotune complete.
PLC Output Register Number Output Data Comment
1 4172 Successful write code 1000 (Hex) (4096dec) + tag address 76 (decimal)
= 4172
2 Anything
3 Anything
4 Anything
To determine when Autotune is complete:
Look at the PROFIBUS-DP Input data until either bit 3 (Self Tune Fail) of the value field is set, or bit 12 (Autotune enabled)
is cleared. There is no need to set up more requests, since the value field will be automatically updated by the slave, but you
should not try to access other demand data until this operation has completed. Any value for register 1 other than 4172
signifies an error has occurred, in which case register 4 will contain an error code of 0 or 1 or 2.
PLC Input Register Number Input Data Comment
1 4172
Anything
3 Anything
4 XXXX The value of the Control Status Word