
Description of the DP Functions, Data, and Error Codes
DP Base Programming Interface for CP 5613/CP 5614
150
C79000-G8976-C108-01
4.3.4 Checking the Slaves for Changed Data
Uses of the Data Changed Information
The process image of the CP 5613/CP 5614 contains a memory area where you
can see which slave data have changed.
You can use this property to quickly check where data have changed without
having to use semaphores.
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 slave have changed data,
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->ef.input[i].req_mask == DPR_DATA_CHANGE )
{ /* Changed data found on slave i */
/* Mask released again */
p->ef.input[i].req_mask =
DPR_DATA_INT_CLEAR_AND_UNMASK;
sum++;
}
}
Comentarios a estos manuales