Siemens SIMATIC NET PROFIBUS Manual de servicio Pagina 146

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 238
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 145
Description of the DP Functions, Data, and Error Codes
DP Base Programming Interface for CP 5613/CP 5614
146
C79000-G8976-C108-01
4.3.2 Reading the Diagnostic Data of a DP Slave
Consistent Reading of the Diagnostic Data
Each individual slave has a fixed data area in the process image of the
CP 5613/CP 5614 (for more information on the data format see Section 4.6).
To allow the diagnostic data of a slave to be read consistently, your user program
first locks this data area to prevent it being updated by the DP master, then
accesses the area, and releases it again. The program locks the area by writing the
slave number to a control register in the process image. The data area is released
again by writing the value DPR_DP_UNLOCK to the same register.
There is also a counter that counts the diagnostic data of the relevant slave.
Example of Consistent Reading of the Diagnostic Data
"p" is a pointer to the process image that your user program obtained with the
"DP_get_pointer" call. Then 200 bytes of the diagnostic data of slave no. 5 are
copied to a local buffer "buf":
/* Lock the diagnostic data area against updating */
p->ctr.D_lock_diag_slave_adr = 5;
/* Evaluate the counter */
count = p->pi.slave_diag[5].diag_count;
/* Copy current data */
memcpy(buf, &p->pi.slave_diag[5].data[0],
p->pi.slave_diag[5].diag_len);
/* Cancel lock again */
p->ctr.D_lock_diag_slave_adr = DPR_DP_UNLOCK;
Vista de pagina 145
1 2 ... 141 142 143 144 145 146 147 148 149 150 151 ... 237 238

Comentarios a estos manuales

Sin comentarios