28.03.2014 Views

PC Control / Profi Control 645-12M Instruction Manual pdf - Kuhnke

PC Control / Profi Control 645-12M Instruction Manual pdf - Kuhnke

PC Control / Profi Control 645-12M Instruction Manual pdf - Kuhnke

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.9.2.3.2. Program example: read diagnostic data<br />

This example is to illustrate the typical process of requesting<br />

a service:<br />

; Read diagnostic data of DP slave 1<br />

; Data interface: SBM2.00...<br />

; In this example, the task is started by the following marker:<br />

; - SM00.07<br />

;<br />

******************************************************************************<br />

; —— Is there an active task already?<br />

L DIA_TASK SBM02.00 ; (diagnostic data in task byte)<br />

CMP 0<br />

JP= NEW_TASK ; all bits=0: no task<br />

JP DP_CONT ; else: restart KUBES module<br />

; —— New task requested?<br />

; Activate<br />

NEW_TASK L S1_DIAG SM00.07 ; (task slave 1: read diag. data)<br />

J<strong>PC</strong>N END ; request no diag. data -> jump<br />

; —— Start service<br />

START L 9 ; service 9<br />

= DIA_TASK SBM02.00 ; (diagnostic data in task byte)<br />

L 1 ; station1<br />

= DIA_PB# SBM02.02 ; (station number diag. data)<br />

L 31 ; number of diag. data bytes<br />

= DIA_LEN SBM02.03 ; (length data field diag. data)<br />

; —— Start KUBES module DP_CTRL<br />

DP_CONT JPK DP_CTRL , _____<br />

DIA_TASK -|_____|-<br />

; Poll task status<br />

L DIA_TASK SBM02.00 ; (diagnostic data in task byte)<br />

JPB FAILURE ; bit7=1: error<br />

CMP 0<br />

JP= OK ; all bits=0: task completed<br />

JP END ; task not completed<br />

; —— Task completed, clear task markers<br />

OK =0 S1_DIAG SM00.07 ; (task: read diag. data of slave 1)<br />

JP END<br />

; —— Error evaluation<br />

FAILURE L DIA_FAIL SBM02.01 ; (error byte diag. data)<br />

END NOP<br />

4 - 52

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!