24.10.2013 Views

Configuring Hardware and Communication Connections STEP 7.pdf

Configuring Hardware and Communication Connections STEP 7.pdf

Configuring Hardware and Communication Connections STEP 7.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Configuring</strong> the Distributed I/O (DP)<br />

Example 2: Evaluation of Diagnostic Data in OB 82 with SFB 54 "RALRM"<br />

The target area for diagnostic data must be large enough to hold st<strong>and</strong>ard<br />

diagnostics (6 bytes), identifier specific diagnostics (3 bytes for 12 slots) <strong>and</strong> the<br />

evaluation of device-specific diagnostics (module status only, which requires 7<br />

more bytes).<br />

Extended evaluation (channel-specific diagnostics) would require the reservation of<br />

additional bytes, provided the DP Slave supports this function.<br />

// ...<br />

// ...<br />

L 120 //determine the start address for the<br />

//module/station,<br />

T "Slotadresse_Diag" //from which the diagnosis is to be<br />

//fetched<br />

CALL "RALRM" , "DB54"<br />

MODE :="Alle_Params" // 1 = all output parameters are set<br />

F_ID :="Slotadresse_Diag" //start address of the slot from<br />

//which the diagnosis is to be fetched<br />

MLEN :=20 //max. length of diagnostic data in bytes<br />

NEW :="neu" //irrelevant<br />

STATUS:="RET_VAL" //function result, error message<br />

ID :="Slotadresse_Alarm" //start address of the slot from which an<br />

//interrupt was received<br />

LEN :="Laenge_Alarminfo" //length of the supplementary interrupt<br />

//info (4 bytes header info+16 bytes<br />

//diagnostic data<br />

TINFO :=P#M 100.0 BYTE 28 //pointer for OB start info + management<br />

//info: 28 bytes as of MB 100<br />

AINFO :=P#M 130.0 BYTE 20 //pointer to the target area in which the<br />

//diagnostic data is to be stored<br />

// ...<br />

//Structure of the stored diagnostic data:<br />

// MB 130 to MB 133: header info (length, identifier, slot)<br />

// MB 134 to MB 139: St<strong>and</strong>ard Diagnostics (6 bytes)<br />

// MB 140 to MB 142: identifier specific diagnostics (3 bytes)<br />

// MB 143 to MB 149: module status (7 bytes)<br />

// ...<br />

U M 141.0 //slot 1 error?<br />

SPB stp1<br />

BE<br />

stp1: L MB 147 //fetch module status slots 1 to 4<br />

UW W#16#3 //filter slot 1<br />

L W#16#2 //2-bit status 'wrong module',<br />

//wrong module inserted<br />

==I<br />

S A 0.1 //reaction to wrong module<br />

//..<br />

L MB 147 //fetch module status slots 1 to 4<br />

UW W#16#3 //filter slot 1<br />

L W#16#1 //2-bit status 'invalid data',<br />

//invalid user data<br />

==I<br />

S A 0.2 //reaction to invalid user data<br />

<strong>Configuring</strong> <strong>Hardware</strong> <strong>and</strong> <strong>Communication</strong> <strong>Connections</strong> with <strong>STEP</strong> 7<br />

3-64 A5E00706939-01

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

Saved successfully!

Ooh no, something went wrong!