Siemens S7 and Profibus

S

Thread Starter

Steve

With Profibus communications and Siemens S7, when a fault happens, OB86 is called. What kind of code should be put into OB86 to record the fault and reset communications?
 
D

david mertens

What you program in OB86 is up to you, the important point is that you have OB86 (even empty) in your PLC, if not the PLC will go to stop. Sometimes the OB86 is used to run diagnostics to determine exactly which slave is in error and what the exact error message is, but this can also be determined with the standard diagnostics from simatic manager so it is not really a requirement.
 
In the OB86 you can find out which slave is completly off the Profibus DP. The 20 local databytes have al these information to find out which DP-master give the error and witch slave adress is of the Bus. OB86 is called by a incoming error (slave off the bus) and a outcoing message (slave back on the bus).
On the internetpage off Siemens { "http://www4.ad.siemens.de/support/index.asp?lang=en":http://www4.ad.siemens.de/support/index.asp?lang=en } there are several informations en pdf-files to find out all the information you need. When you need a example then i can deliver that to you, i need then some information about the hardware off your project to make the example.
 
D

Daniel Chartier

Hello;
Most often I don't put any code in the OB86. Just having it in the project allows the CPU to continue functionning when a bus fault comes in, and to clear the fault in the CPU when the Profibus node comes back online; it also sends information directly to the Diagnostics buffer so I can identify the source of the problem. There is however a package FB125/FC125 (you can download it from the Siemens website) for Profibus diagnostics that is friendlier to use, if you want to do fault recording.
Hope this helps,
Daniel Chartier
 
H

Hakan Ozevin

I am not sure about the number of that OB, but to program an OB will prevent CPU to stop. You can set a bit in the OB and use/record in your program. The code can be as simple as

S "Flag".

In this case, you dont need to reset the communication, since master (S7 CPU) did not fail.
 
What I can tell you is that the important point is not what you put in the OB, it is wether it is there or not. The empty OB will prevent you CPU from going in stop.
 
R
The OB86 TEMP Variables holds information (address, incoming/outgoing event, etc.)about the failed DP Slave, so you can evaluate it.

Here is the simple code (written in SCL) I used::

//---------------------------------------------
ORGANIZATION_BLOCK OB86

VAR_TEMP
// Reserved
Info: ARRAY[0..19] OF BYTE;
// Temporary Variables
DP_Addr : INT;
END_VAR

BEGIN
// Statements
DP_Addr := WORD_TO_INT(BYTE_TO_WORD(Info [11]));
// These transformations are need for CASE
//statement, because it works only with
//INT argument
CASE DP_Addr OF
3:
// S7-215_2DP - Burners 1&3 /DP_Address = 3/
IF Info[0] = 16#39 THEN M160.0 := TRUE;
ELSE M160.0 := FALSE;
END_IF;

4:
// S7-215_2DP - Burners 2&4 //DP_Address = 4/
IF Info[0] = 16#39 THEN M160.1 := TRUE;
ELSE M160.1 := FALSE;
END_IF;

5:
// S7-215_2DP - Burners 5&7 /DP_Address = 5/
IF Info[0] = 16#39 THEN M160.2 := TRUE;
ELSE M160.2 := FALSE;
END_IF;

6:
// S7-215_2DP - Burners 6&8 /DP_Address = 6/
IF Info[0] = 16#39 THEN M160.3 := TRUE;
ELSE M160.3 := FALSE;
END_IF;
END_CASE;
END_ORGANIZATION_BLOCK
//---------------------------------------------

I'll try to explane it.
Info[11] contains address of the DP Slave.
Info[0] is code of the failure:
- B#16#38: outgoing event (DP Slave retrns)
- B#16#39: incoming event (DP Slave falls)
On the failure of DP Slave I simply set the flag, and I evaluate later in the program.
 
Top