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
the function block
and the UDT
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
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
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