
Description of the DP Functions, Data, and Error Codes
DP Base Programming Interface for CP 5613/CP 5614
C79000-G8976-C108-01
153
Example
"p" is a pointer to the process image that your user program obtained with the
"DP_get_pointer" call. To count, for example, how many slaves are in the READY
state, you would write a program like that shown below, where "sum" contains the
result:
unsigned short sum = 0;
unsigned short i;
for (i = 0; i< DPR_MAX_SLAVE_ADDR; i++)
{
if (p->info_watch.slave_info[i].slave_state ==
DPR_SLV_READY)
{
sum++; /* found */
}
}
There is also the DPR_SLV_NOT_READY state that also includes non-configured
slaves.
Note 1
The DP master automatically attempts to reinitialize slaves in the NOT READY
state and to include them in cyclic processing.
Note 2
The user program must not overwrite the slave_state variable.
Note 3
The memory area with index 127 contains the state of the slave module of the
CP 5614.
Note 4
If the slave is in the READY state, this does not necessarily mean that its data are
valid. Diagnostic data may mean that the validity of the data is restricted.
Comentarios a estos manuales