Siemens S7 SCL OB86 timestamp question

bert_iv

Member
Join Date
Apr 2011
Location
somewhere
Posts
5
Hello,

I'm working with OB86 to track some diagnostic data, i write all start information of the OB to a DB including the timestamp.
but when i monitor the DB All data is being copied and the 'date and time' field stays empty, the field background stays grey. I wonder why the background of that field stays grey and why the code does not fill the field, or is the data there but just not being displayed?

thanks for your help

OB86
Code:
(*Diagnostic OB for detect IM151-1 failure**********************************************)
ORGANIZATION_BLOCK OB86
TITLE = 'OB86'
//
// Called during an error on a channel if the diagnostic option is activated
//
AUTHOR: 'Ivens'
NAME: 'OB86'
FAMILY: 'UNICOS'
VAR_TEMP
    OB86_EV_CLASS : BYTE;
    OB86_FLT_ID : BYTE;
    OB86_PRIORITY : BYTE;
    OB86_OB_NUMBR : BYTE;
    OB86_RESERVED_1 : BYTE;
    OB86_RESERVED_2 : BYTE;
    OB86_MDL_ADDR : WORD;
    OB86_Nr_DP: BYTE;
    OB86_DP_MASTER: BYTE;
    OB86_ADDR_DP_SLAVE: WORD;
    OB86_DATE_TIME: DATE_AND_TIME;
END_VAR
BEGIN

CASE WORD_TO_INT((OB86_ADDR_DP_SLAVE AND 2#0000000001111111)) OF
     71 :FB_ET200s_ErDet.DFBXB_03R1_CM_ErDet(EV_CLASS:=OB86_EV_CLASS,
                                        FLT_ID:=OB86_FLT_ID,
                                        PRIORITY:=OB86_PRIORITY,
                                        OB_NUMBR:=OB86_OB_NUMBR,
                                        RESERVED_1:=OB86_RESERVED_1,
                                        RESERVED_2:=OB86_RESERVED_2,
                                        MDL_ADDR:=OB86_MDL_ADDR,
                                        Nr_DP:=OB86_Nr_DP,
                                        DP_MASTER:=OB86_DP_MASTER,
                                        ADDR_DP_SLAVE:=OB86_ADDR_DP_SLAVE,
                                        DATE_TIME:=OB86_DATE_TIME);
     //other cases removed, not relevant

END_ORGANIZATION_BLOCK
the function block
Code:
FUNCTION_BLOCK FB_ET200s_ErDet
TITLE = 'FB_ET200s_ErDet'
//
//  Analog Objects
//
VERSION: '1.0'
AUTHOR: 'UNICOS'
NAME: 'Obj_FO'
FAMILY: 'FO'
(*VARIABLES******************************)
VAR_INPUT 
    EV_CLASS : BYTE;
    FLT_ID : BYTE;
    PRIORITY : BYTE;
    OB_NUMBR : BYTE;
    RESERVED_1 : BYTE;
    RESERVED_2 : BYTE;
    MDL_ADDR : WORD;
    Nr_DP: BYTE;
    DP_MASTER: BYTE;
    ADDR_DP_SLAVE: WORD;
    DATE_TIME: DATE_AND_TIME;
    bit AT ADDR_DP_SLAVE : ARRAY[0..15] OF BOOL ;

                      //entrees
END_VAR
VAR
    index:INT;
    RESET_TRIGGER:BOOL;
    COUNTER_INCOMMING:INT;
    COUNTER_OUTGOING:INT;
    ACTIVE_FAULT_INDEX:INT;
    LAST_RESET_REQUESTED_ULC:DINT;
    TRAP: ARRAY[1..10] OF TYPE_OB86_TRAP;
    temp_reset_time1, temp_reset_time2, temp_reset_time : DINT;
    
END_VAR
BEGIN
IF EV_CLASS = 16#39 THEN //incomming event    
        
        IF index=10 THEN
            index:=1;
        ELSE
            index:=index+1;
        END_IF;
              
       //irrelevant code removed

        TRAP[index].OB86_DATE_TIME:=DATE_TIME;
        //temp := READ_CLK(CDT := TRAP[index].OB86_DATE_TIME);
        //also tried the line above without success
        index:=index;
    
    
    ELSIF EV_CLASS = 16#38 THEN //outgoing event
    
            //irrelevant code removed
            TRAP[index].OB86_DATE_TIME:=DATE_TIME;
            //irrelevant code removed

    END_IF;
;
END_FUNCTION_BLOCK
and the UDT
Code:
(*TYPE for OB86 trap*)
TYPE TYPE_OB86_TRAP
TITLE = 'TYPE_OB86_TRAP'
//
// Used for to catch information from OB86 call
//
AUTHOR: 'Ivens'
NAME: 'DataType'
FAMILY: 'Diagnost'

STRUCT
    OB86_EV_CLASS : BYTE;
    OB86_FLT_ID : BYTE;
    OB86_PRIORITY : BYTE;
    OB86_OB_NUMBR : BYTE;
    OB86_RESERVED_1 : BYTE;
    OB86_RESERVED_2 : BYTE;
    OB86_MDL_ADDR : WORD;
    OB86_Nr_DP: BYTE;
    OB86_DP_MASTER: BYTE;
    OB86_ADDR_DP_SLAVE: WORD;
    OB86_IO_identifier: BOOL;
    AUTO_RESET_TRIGGERED: BOOL;
    AUTO_RESET_RECOVERED: BOOL;
    AUTO_RESET_TIME: DINT;
    OB86_DATE_TIME: DATE_AND_TIME;

END_STRUCT
END_TYPE
 
As a test, try in OB86 to write:

"Trap_DB".TRAP[1].OB86_DATE_TIME := OB86_DATE_TIME ;

Then see if you get some time data in "Trap_DB".TRAP[1].OB86_DATE_TIME when you trigger OB86.
 
No it does not work, I had already tried that...
My first version of the program was completely done in OB86 before I used the FB
 
In my programs I have a BLKMOV in the error OBs.
The source in OB86 is #OB86_DATE_TIME, and the destination is a DB address with DATE_AND_TIME format. I think it works. Never had any use for it though so I am not 100% sure.

So you trigger an OB86, and in the diagnostics buffer you get an entry, but still no data in the datablock ?
 
By the way.

The reason why I havent delved very much into making my own diagnostic error logging, is because with the new CPUs with webserver onboard, anyone can just go online and check the diagnostic buffer. Much better than wasting a lot of time trying to make something that will never be just half as good as the real thing.
 

Similar Topics

Hello, When you want compare values of an array to a range of numbers is it a right way to do that? FUNCTION ADD VAR_IN_OUT A:ARRAY[1..50]...
Replies
5
Views
2,071
Hi All, I need to try and convert some code from Siemens SCL (TIA16) over to Allen Bradley RS5000. I have attached an image of the SCL and what...
Replies
10
Views
4,056
in the scl code written in screenshot Line 1 condition is false but still the program checking the line 2 condition and says it is true i had...
Replies
3
Views
1,760
I am new to PLC programming. Is there a standard way to incorporate alarms / warnings / events such as the exceptions in C++ or Java where you can...
Replies
5
Views
1,979
Hello All, I am new to programming with Tia Portal and I am having difficulty with something that we have found "easy" in other programming...
Replies
3
Views
2,379
Back
Top Bottom