Initial commit
This commit is contained in:
68
TC3_CNCPLCBase/Messages/FB_Alarm.TcPOU
Normal file
68
TC3_CNCPLCBase/Messages/FB_Alarm.TcPOU
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
|
||||
<POU Name="FB_Alarm" Id="{8a933d14-5c49-48f7-b88f-d4600752ceb3}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Alarm
|
||||
VAR_INPUT
|
||||
Event : TcEventEntry; // AlarmEntry from TMS Editor. Example: TC_EVENTS.Alarms.Alarm1
|
||||
Raise : BOOL; // true -> Alarm is active, false -> Alarm not active
|
||||
AddInfo: STRING; // if <> empty -> additional Info that is transfered together with alarm
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
_alarm : FB_TcAlarm;
|
||||
_initDone : BOOL;
|
||||
_rTrigRaise : R_TRIG;
|
||||
_fTrigRaise : F_TRIG;
|
||||
_fbSourceInfo : FB_TcSourceInfo;
|
||||
_fbJson : FB_JsonSaxWriter;
|
||||
_sJsonDoc : STRING(255);
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[(* ========================================================= *)
|
||||
(* FUN: FB_Alarm *)
|
||||
(* --------------------------------------------------------- *)
|
||||
(* Desc: Simple usage of Eventlogger2 Alarms *)
|
||||
(* Author: MiB *)
|
||||
(* Date: 09.03.2021 *)
|
||||
(* Rev.: 1.0 *)
|
||||
(* ========================================================= *)
|
||||
|
||||
|
||||
// init
|
||||
IF NOT _initDone AND Event.nEventId <> 0 THEN
|
||||
_fbSourceInfo.sName := 'PLC';
|
||||
_alarm.CreateEx(Event, FALSE, _fbSourceInfo );
|
||||
_initDone := TRUE;
|
||||
END_IF
|
||||
|
||||
// raise alarm
|
||||
_rTrigRaise(clk := Raise);
|
||||
IF _rTrigRaise.Q AND NOT _alarm.bRaised THEN
|
||||
IF LEN(AddInfo) > 0 THEN
|
||||
_fbJson.ResetDocument();
|
||||
_fbJson.StartObject();
|
||||
_fbJson.AddKey('AddInfo');
|
||||
_fbJson.AddString(AddInfo);
|
||||
_fbJson.EndObject();
|
||||
_sJsonDoc := _fbJson.GetDocument();
|
||||
_alarm.SetJsonAttribute(_sJsonDoc);
|
||||
ELSE
|
||||
_alarm.SetJsonAttribute('');
|
||||
END_IF
|
||||
_alarm.Raise(0);
|
||||
END_IF
|
||||
|
||||
// clear alarm
|
||||
_fTrigRaise(clk := Raise);
|
||||
IF _fTrigRaise.Q AND _alarm.bRaised THEN
|
||||
_alarm.Clear(0, FALSE);
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="FB_Alarm">
|
||||
<LineId Id="3" Count="37" />
|
||||
<LineId Id="2" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
201
TC3_CNCPLCBase/Messages/FB_ExtSimpleEventLog.TcPOU
Normal file
201
TC3_CNCPLCBase/Messages/FB_ExtSimpleEventLog.TcPOU
Normal file
@@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.6">
|
||||
<POU Name="FB_ExtSimpleEventLog" Id="{715e4e5f-ea7f-48d3-986e-f1a58d16fa50}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[///****************************************************************************************
|
||||
///Name: FB_ExtSimpleEventLog
|
||||
///Date: 13.10.2004
|
||||
///Author: Dirk Nordberg (BECKHOFF INDUSTRIE ELEKTRONIK)
|
||||
///
|
||||
///Description: Function block to control the EventLogger
|
||||
/// Messages can be activated or deactivated through an array of bool.
|
||||
/// The subscription of the array is equivalent to EventID from EventLogger.
|
||||
/// Funtion block will be initialized with Init flag, then the busy flag is set true.
|
||||
///
|
||||
/// Revision: 2.0
|
||||
/// History: 13.10.2004 Ng start coding
|
||||
/// 17.04.2005 MK runtime optimized
|
||||
/// 06.09.2005 MiB extended version (renamed to FB_ExtSimpleEventLog)
|
||||
/// 30.05.2017 TV messages with format parameters
|
||||
///****************************************************************************************
|
||||
FUNCTION_BLOCK FB_ExtSimpleEventLog
|
||||
VAR_INPUT
|
||||
/// Rising flag starts the initialization
|
||||
Init: BOOL;
|
||||
SourceId: UINT;
|
||||
/// Alarm error class
|
||||
Class: UINT;
|
||||
/// Activate or deaktivate confirmation
|
||||
QuitRequired: BOOL;
|
||||
/// Adress of the array for the messages
|
||||
adrAlarmArray: POINTER TO BOOL;
|
||||
/// ...with constant boundaries ARRAY_LBOUND to ARRAY_UBOUND for array size
|
||||
adrQuitArray: POINTER TO BOOL;
|
||||
/// ...with constant boundaries ARRAY_LBOUND to ARRAY_UBOUND for array size
|
||||
adrEventData: POINTER TO ST_EventData;
|
||||
/// Format String for message
|
||||
sFormatString: STRING := '';
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
Busy: BOOL;
|
||||
Err: BOOL;
|
||||
ErrId: UDINT;
|
||||
END_VAR
|
||||
VAR CONSTANT
|
||||
ARRAY_LBOUND: UDINT := FIRST_MESSAGE;
|
||||
ARRAY_UBOUND: UDINT := LAST_MESSAGE;
|
||||
TCEVENTDATAFORMATSTRING: STRING(80) := ' ';
|
||||
STATE_INIT: INT := 0;
|
||||
STATE_IDLE: INT := 1;
|
||||
STATE_RESET_EVENT: INT := 2;
|
||||
STATE_QUIT_EVENT: INT := 3;
|
||||
STATE_RESET_END: INT := 4;
|
||||
STATE_WAIT: INT := 5;
|
||||
END_VAR
|
||||
VAR
|
||||
state: INT;
|
||||
///{flag nowatch on }
|
||||
bReady: BOOL;
|
||||
nMsgHasChanged: DINT;
|
||||
bEvtState: ARRAY[ARRAY_LBOUND..ARRAY_UBOUND] OF BOOL;
|
||||
event: ARRAY[ARRAY_LBOUND..ARRAY_UBOUND] OF ADSLOGEVENT;
|
||||
idx: UDINT;
|
||||
CfgEvent: TcEvent;
|
||||
bWait: BOOL;
|
||||
ptAlarm: POINTER TO BOOL;
|
||||
ptQuit: POINTER TO BOOL;
|
||||
RT_Init: R_TRIG;
|
||||
ptData: POINTER TO ST_EventData;
|
||||
stDummy: ST_EventData;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><;
|
||||
END_FOR;
|
||||
State := STATE_IDLE;
|
||||
|
||||
STATE_IDLE:
|
||||
(* nothing to do *)
|
||||
IF nMsgHasChanged = 0 AND NOT RT_Init.Q THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF adrAlarmArray <> 0 THEN
|
||||
ptAlarm := adrAlarmArray;
|
||||
ptData := adrEventData;
|
||||
IF ptData <> 0 THEN
|
||||
sFormatString := '%d%s';
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
event[idx].EventConfigData.DataFormatStrAddress := ADR(sFormatString);
|
||||
event[idx].EventConfigData.SourceId := SourceId;
|
||||
event[idx].EventDataAddress := ptData ;
|
||||
event[idx].EventDataLength := SIZEOF(stDummy);
|
||||
event[idx]();
|
||||
ptData := ptData + SIZEOF(stDummy);
|
||||
END_FOR
|
||||
END_IF
|
||||
IF CfgEvent.bQuitRequired AND adrQuitArray <> 0 THEN
|
||||
ptQuit := adrQuitArray;
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
event[idx](Event:=ptAlarm^, EventQuit:=ptQuit^);
|
||||
ptAlarm := ptAlarm + 1;
|
||||
ptQuit := ptQuit + 1;
|
||||
END_FOR;
|
||||
ELSE
|
||||
bReady := TRUE;
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
event[idx](Event:=ptAlarm^);
|
||||
ptAlarm := ptAlarm + 1;
|
||||
IF (NOT(event[idx].Event = TRUE (* event is set *)
|
||||
AND event[idx].Quit = FALSE
|
||||
AND event[idx].EventState = TCEVENTSTATE_SIGNALED)
|
||||
AND NOT(event[idx].Event = FALSE (* event is reset *)
|
||||
AND event[idx].Quit = TRUE
|
||||
AND event[idx].EventState = TCEVENTSTATE_INVALID)) THEN
|
||||
bReady := FALSE;
|
||||
END_IF
|
||||
END_FOR;
|
||||
|
||||
(* copy the status *)
|
||||
IF bReady THEN
|
||||
MEMCPY(ADR(bEvtState), adrAlarmArray, SIZEOF(bEvtState));
|
||||
END_IF
|
||||
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
IF RT_Init.Q THEN
|
||||
Busy := TRUE;
|
||||
State := STATE_RESET_EVENT;
|
||||
END_IF
|
||||
|
||||
STATE_RESET_EVENT:(*---------------------------------- clear messages ----------------------------------------*)
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
IF event[idx].EventState = TCEVENTSTATE_SIGNALED THEN
|
||||
event[idx](Event:=FALSE, EventQuit:= FALSE, FbCleanup:= FALSE, TMOUT:= t#1s);
|
||||
IF event[idx].Err THEN
|
||||
Err := TRUE;
|
||||
ErrId := event[idx].ErrId;
|
||||
IF event[idx].ErrId = 1282 THEN (* Message Router: mailbox full *)
|
||||
event[idx](Event:=FALSE, EventQuit:= FALSE, FbCleanup:= FALSE);
|
||||
RETURN;
|
||||
END_IF
|
||||
END_IF
|
||||
END_IF;
|
||||
END_FOR;
|
||||
State := STATE_QUIT_EVENT;
|
||||
|
||||
STATE_QUIT_EVENT:(*---------------------------------- quit messages ----------------------------------------*)
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
IF event[idx].EventState = TCEVENTSTATE_SIGNALED THEN
|
||||
event[idx](Event:=FALSE, EventQuit:= TRUE, FbCleanup:= FALSE, TMOUT:= t#1s);
|
||||
IF event[idx].Err THEN
|
||||
Err := TRUE;
|
||||
ErrId := event[idx].ErrId;
|
||||
IF event[idx].ErrId = 1282 THEN (* Message Router: mailbox full *)
|
||||
event[idx](Event:=FALSE, EventQuit:= FALSE, FbCleanup:= FALSE);
|
||||
RETURN;
|
||||
END_IF
|
||||
END_IF
|
||||
END_IF;
|
||||
END_FOR;
|
||||
State := STATE_RESET_END;
|
||||
|
||||
STATE_RESET_END:
|
||||
bWait := FALSE;
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
event[idx](Event:=FALSE, EventQuit:= FALSE, FbCleanup:= FALSE);
|
||||
IF event[idx].EventState = TCEVENTSTATE_SIGNALED THEN
|
||||
bWait := TRUE;
|
||||
END_IF
|
||||
END_FOR;
|
||||
IF NOT bWait THEN
|
||||
State := STATE_INIT;
|
||||
END_IF
|
||||
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="FB_ExtSimpleEventLog">
|
||||
<LineId Id="285" Count="121" />
|
||||
<LineId Id="2" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
194
TC3_CNCPLCBase/Messages/FB_SimpleEventLog.TcPOU
Normal file
194
TC3_CNCPLCBase/Messages/FB_SimpleEventLog.TcPOU
Normal file
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.6">
|
||||
<POU Name="FB_SimpleEventLog" Id="{824df5dd-5df2-4652-aeac-edaeb94d45d5}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[///****************************************************************************************
|
||||
///Name: FB_SimpleEventLog
|
||||
///Date: 13.10.2004
|
||||
///Author: Dirk Nordberg (BECKHOFF INDUSTRIE ELEKTRONIK)
|
||||
///
|
||||
///Description: Function block to control the EventLogger
|
||||
/// Messages can be activated or deactivated through an array of bool.
|
||||
/// The subscription of the array is equivalent to EventID from EventLogger.
|
||||
/// Funtion block will be initialized with Init flag, then the busy flag is set true.
|
||||
///
|
||||
/// Revision: 1.4
|
||||
/// History: 13.10.2004 Ng start coding
|
||||
/// 17.04.2005 MK runtime optimized
|
||||
/// 07.07.2005 MK short puls BF
|
||||
/// 29.11.2010 MiB quittierungspflichtige Merker funktionieren nun wieder
|
||||
/// 21.06.2013 TV change : data type for pointer address from uint to pointer of int
|
||||
///****************************************************************************************
|
||||
FUNCTION_BLOCK FB_SimpleEventLog
|
||||
VAR_INPUT
|
||||
/// Rising flag starts the initialization
|
||||
Init: BOOL;
|
||||
/// Number of the source Id
|
||||
SourceId: UINT;
|
||||
/// Alarm error class
|
||||
Class: UINT;
|
||||
/// Activate or deaktivate confirmation
|
||||
QuitRequired: BOOL;
|
||||
/// Adress of the array for the messages
|
||||
adrAlarmArray: POINTER TO BOOL;
|
||||
/// ...with constant boundaries ARRAY_LBOUND to ARRAY_UBOUND for array size
|
||||
adrQuitArray: POINTER TO BOOL;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
Busy: BOOL;
|
||||
Err: BOOL;
|
||||
ErrId: UDINT;
|
||||
END_VAR
|
||||
VAR CONSTANT
|
||||
ARRAY_LBOUND: UDINT := FIRST_MESSAGE;
|
||||
ARRAY_UBOUND: UDINT := LAST_MESSAGE;
|
||||
TCEVENTDATAFORMATSTRING: STRING := ' ';
|
||||
STATE_INIT: INT := 0;
|
||||
STATE_IDLE: INT := 1;
|
||||
STATE_RESET_EVENT: INT := 2;
|
||||
STATE_QUIT_EVENT: INT := 3;
|
||||
STATE_RESET_END: INT := 4;
|
||||
STATE_WAIT: INT := 5;
|
||||
END_VAR
|
||||
VAR
|
||||
state: INT;
|
||||
///{flag nowatch on }
|
||||
bReady: BOOL := TRUE;
|
||||
nMsgHasChanged: DINT;
|
||||
bEvtState: ARRAY[ARRAY_LBOUND..ARRAY_UBOUND] OF BOOL;
|
||||
event: ARRAY[ARRAY_LBOUND..ARRAY_UBOUND] OF ADSLOGEVENT;
|
||||
idx: UDINT;
|
||||
CfgEvent: TcEvent;
|
||||
bWait: BOOL;
|
||||
ptAlarm: POINTER TO BOOL;
|
||||
ptQuit: POINTER TO BOOL;
|
||||
RT_Init: R_TRIG;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><;
|
||||
END_FOR;
|
||||
State := STATE_IDLE;
|
||||
|
||||
STATE_IDLE:
|
||||
(* nothing to do *)
|
||||
IF nMsgHasChanged = 0
|
||||
AND NOT QuitRequired
|
||||
AND bReady = TRUE
|
||||
AND NOT RT_Init.Q THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF adrAlarmArray <> 0 THEN
|
||||
ptAlarm := adrAlarmArray;
|
||||
IF CfgEvent.bQuitRequired AND adrQuitArray <> 0 THEN
|
||||
ptQuit := adrQuitArray;
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
event[idx](Event:=ptAlarm^, EventQuit:=ptQuit^);
|
||||
ptAlarm := ptAlarm + 1;
|
||||
ptQuit := ptQuit + 1;
|
||||
END_FOR;
|
||||
bReady := TRUE;
|
||||
ELSE
|
||||
bReady := TRUE;
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
event[idx](Event:=ptAlarm^);
|
||||
IF (NOT (ptAlarm^ = TRUE
|
||||
AND event[idx].Event = TRUE (* event is set/on *)
|
||||
AND event[idx].Quit = FALSE
|
||||
AND event[idx].EventState = TCEVENTSTATE_SIGNALED)
|
||||
AND NOT (ptAlarm^ = FALSE
|
||||
AND event[idx].Event = FALSE (* event is reset/off *)
|
||||
AND event[idx].Quit = TRUE
|
||||
AND event[idx].EventState = TCEVENTSTATE_INVALID)) THEN
|
||||
bReady := FALSE;
|
||||
END_IF
|
||||
ptAlarm := ptAlarm + 1;
|
||||
END_FOR;
|
||||
|
||||
(* copy the status *)
|
||||
IF bReady THEN
|
||||
MEMCPY(ADR(bEvtState), adrAlarmArray, SIZEOF(bEvtState));
|
||||
END_IF
|
||||
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
IF RT_Init.Q THEN
|
||||
Busy := TRUE;
|
||||
State := STATE_RESET_EVENT;
|
||||
END_IF
|
||||
|
||||
STATE_RESET_EVENT:(*---------------------------------- clear messages ----------------------------------------*)
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
IF event[idx].EventState = TCEVENTSTATE_SIGNALED THEN
|
||||
event[idx](Event:=FALSE, EventQuit:= FALSE, FbCleanup:= FALSE, TMOUT:= t#1s);
|
||||
IF event[idx].Err THEN
|
||||
Err := TRUE;
|
||||
ErrId := event[idx].ErrId;
|
||||
IF event[idx].ErrId = 1282 THEN (* Message Router: mailbox full *)
|
||||
event[idx](Event:=FALSE, EventQuit:= FALSE, FbCleanup:= FALSE);
|
||||
RETURN;
|
||||
END_IF
|
||||
END_IF
|
||||
END_IF;
|
||||
END_FOR;
|
||||
State := STATE_QUIT_EVENT;
|
||||
|
||||
STATE_QUIT_EVENT:(*---------------------------------- quit messages ----------------------------------------*)
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
IF event[idx].EventState = TCEVENTSTATE_SIGNALED THEN
|
||||
event[idx](Event:=FALSE, EventQuit:= TRUE, FbCleanup:= FALSE, TMOUT:= t#1s);
|
||||
IF event[idx].Err THEN
|
||||
Err := TRUE;
|
||||
ErrId := event[idx].ErrId;
|
||||
IF event[idx].ErrId = 1282 THEN (* Message Router: mailbox full *)
|
||||
event[idx](Event:=FALSE, EventQuit:= FALSE, FbCleanup:= FALSE);
|
||||
RETURN;
|
||||
END_IF
|
||||
END_IF
|
||||
END_IF;
|
||||
END_FOR;
|
||||
State := STATE_RESET_END;
|
||||
|
||||
STATE_RESET_END:
|
||||
bWait := FALSE;
|
||||
FOR idx := ARRAY_LBOUND TO ARRAY_UBOUND BY 1 DO
|
||||
event[idx](Event:=FALSE, EventQuit:= FALSE, FbCleanup:= FALSE);
|
||||
IF event[idx].EventState = TCEVENTSTATE_SIGNALED THEN
|
||||
bWait := TRUE;
|
||||
END_IF
|
||||
END_FOR;
|
||||
IF NOT bWait THEN
|
||||
State := STATE_INIT;
|
||||
END_IF
|
||||
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="FB_SimpleEventLog">
|
||||
<LineId Id="3" Count="118" />
|
||||
<LineId Id="2" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
19
TC3_CNCPLCBase/Messages/Global_Messages.TcGVL
Normal file
19
TC3_CNCPLCBase/Messages/Global_Messages.TcGVL
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.6">
|
||||
<GVL Name="Global_Messages" Id="{37dff550-8eb5-40c9-88e9-ab900d467742}">
|
||||
<Declaration><![CDATA[VAR_GLOBAL
|
||||
///--------------------------
|
||||
/// Messages
|
||||
///--------------------------
|
||||
MSG_WARNING_List: ARRAY[FIRST_MESSAGE..LAST_MESSAGE] OF BOOL;
|
||||
MSG_WARNING_ListQuit: ARRAY[FIRST_MESSAGE..LAST_MESSAGE] OF BOOL;
|
||||
MSG_ALARM_List: ARRAY[FIRST_MESSAGE..LAST_MESSAGE] OF BOOL;
|
||||
MSG_ALARM_ListQuit: ARRAY[FIRST_MESSAGE..LAST_MESSAGE] OF BOOL;
|
||||
END_VAR
|
||||
|
||||
VAR_GLOBAL CONSTANT
|
||||
FIRST_MESSAGE: UDINT := 1;
|
||||
LAST_MESSAGE: UDINT := 50;
|
||||
END_VAR]]></Declaration>
|
||||
</GVL>
|
||||
</TcPlcObject>
|
||||
89
TC3_CNCPLCBase/Messages/PRG_Messages.TcPOU
Normal file
89
TC3_CNCPLCBase/Messages/PRG_Messages.TcPOU
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.6">
|
||||
<POU Name="PRG_Messages" Id="{3add6422-7f87-47f0-a78a-763357959f3f}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM PRG_Messages
|
||||
VAR
|
||||
bStart: BOOL;
|
||||
fbWarningMessages : FB_SimpleEventLog;
|
||||
fbAlarmMessages : FB_SimpleEventLog;
|
||||
//fbExAlarmMessages : FB_ExtSimpleEventLog;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[(*
|
||||
TCEVENTCLASS_NONE :=0, No class
|
||||
TCEVENTCLASS_MAINTENANCE :=1, Maintenance hint
|
||||
TCEVENTCLASS_MESSAGE :=2, Message
|
||||
TCEVENTCLASS_HINT :=3, Hint
|
||||
TCEVENTCLASS_STATEINFO :=4, State information
|
||||
TCEVENTCLASS_INSTRUCTION :=5, Instruction
|
||||
TCEVENTCLASS_WARNING :=6, Warning
|
||||
TCEVENTCLASS_ALARM :=7, Alarm
|
||||
TCEVENTCLASS_PARAMERROR :=8 Parameter error
|
||||
*)
|
||||
|
||||
|
||||
(* Shows how to generate messages *)
|
||||
IF NOT bStart THEN
|
||||
bStart := TRUE;
|
||||
|
||||
fbWarningMessages
|
||||
(Init := TRUE,
|
||||
SourceId := 51,
|
||||
Class := TCEVENTCLASS_WARNING,
|
||||
QuitRequireD := FALSE,
|
||||
adrAlarmArray := ADR(MSG_WARNING_List),
|
||||
adrQuitArray := ADR(MSG_WARNING_ListQuit)
|
||||
);
|
||||
|
||||
fbAlarmMessages
|
||||
(Init := TRUE,
|
||||
SourceId := 50,
|
||||
Class := TCEVENTCLASS_ALARM,
|
||||
QuitRequired := FALSE,
|
||||
adrAlarmArray := ADR(MSG_ALARM_List),
|
||||
adrQuitArray := ADR(MSG_ALARM_ListQuit)
|
||||
);
|
||||
(*
|
||||
fbExAlarmMessages(
|
||||
Init:= TRUE,
|
||||
SourceId:= 52,
|
||||
Class:= TCEVENTCLASS_WARNING,
|
||||
QuitRequired:= FALSE,
|
||||
adrAlarmArray:= ADR(MSG_ExALARM_List),
|
||||
adrQuitArray:= ADR(MSG_ExALARM_ListQuit),
|
||||
adrEventData:= ADR(MSG_ExALARM_EventData),
|
||||
sFormatString:= '%d%s'
|
||||
);
|
||||
*)
|
||||
ELSE
|
||||
fbWarningMessages
|
||||
(Init := FALSE);
|
||||
|
||||
fbAlarmMessages
|
||||
(Init := FALSE);
|
||||
(*
|
||||
fbExAlarmMessages
|
||||
(Init := FALSE);
|
||||
*)
|
||||
END_IF
|
||||
|
||||
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="PRG_Messages">
|
||||
<LineId Id="3" Count="33" />
|
||||
<LineId Id="53" Count="0" />
|
||||
<LineId Id="55" Count="1" />
|
||||
<LineId Id="74" Count="0" />
|
||||
<LineId Id="57" Count="5" />
|
||||
<LineId Id="54" Count="0" />
|
||||
<LineId Id="75" Count="0" />
|
||||
<LineId Id="37" Count="5" />
|
||||
<LineId Id="63" Count="2" />
|
||||
<LineId Id="76" Count="0" />
|
||||
<LineId Id="43" Count="2" />
|
||||
<LineId Id="2" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
53
TC3_CNCPLCBase/Messages/PRG_MessagesV2.TcPOU
Normal file
53
TC3_CNCPLCBase/Messages/PRG_MessagesV2.TcPOU
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
|
||||
<POU Name="PRG_MessagesV2" Id="{f2f74d3f-6d68-41d2-886b-e5cb709738b9}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM PRG_MessagesV2
|
||||
VAR
|
||||
arrAlarmSimple: ARRAY[1..10] OF FB_Alarm;
|
||||
bTestAlarm1: BOOL;
|
||||
bTestAlarm2: BOOL;
|
||||
bTestAlarm3: BOOL;
|
||||
sTestString : STRING := 'this is a test line';
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><;
|
||||
arrAlarmSimple[1].Raise := bTestAlarm1;
|
||||
arrAlarmSimple[1].AddInfo := sTestString;
|
||||
|
||||
|
||||
|
||||
arrAlarmSimple[2](Event := TC_EVENTS.Alarms.Alarm2);
|
||||
arrAlarmSimple[2].Raise := bTestAlarm2;
|
||||
|
||||
arrAlarmSimple[3](Event := TC_EVENTS.Alarms.Alarm3);
|
||||
arrAlarmSimple[3].Raise := bTestAlarm3;
|
||||
*)
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="PRG_MessagesV2">
|
||||
<LineId Id="24" Count="1" />
|
||||
<LineId Id="27" Count="0" />
|
||||
<LineId Id="29" Count="0" />
|
||||
<LineId Id="28" Count="0" />
|
||||
<LineId Id="7" Count="0" />
|
||||
<LineId Id="17" Count="0" />
|
||||
<LineId Id="19" Count="0" />
|
||||
<LineId Id="39" Count="0" />
|
||||
<LineId Id="18" Count="0" />
|
||||
<LineId Id="15" Count="0" />
|
||||
<LineId Id="8" Count="0" />
|
||||
<LineId Id="23" Count="0" />
|
||||
<LineId Id="21" Count="0" />
|
||||
<LineId Id="5" Count="0" />
|
||||
<LineId Id="14" Count="0" />
|
||||
<LineId Id="40" Count="0" />
|
||||
<LineId Id="30" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user