ADSLOGDINT
![ADSLOGDINT 1:](Images/png/9007199286090763__Web.png)
This function issues when called a message box holding a specifiable text on the screen, and writes an entry into the system’s log. Since a PLC program is cyclically processed, it is necessary for an item such as a message box to be output under edge-control. This is most easily achieved with an R_TRIG or F_TRIG function block placed in series (see also examples below).
Using the ADSLOGDINT function a DINT value (4 bytes signed integer) can be inserted in the text to be output at a point specified by the user. For this purpose the stored format string must contain the characters '%d' at the desired location. The return parameter contains the function error code, or 0 if successful.
FUNCTION ADSLOGDINT : DINT
Inputs
VAR_INPUT
msgCtrlMask : DWORD;
msgFmtStr : T_MaxString;
dintArg : DINT;
END_VAR
Name | Type | Description |
---|---|---|
msgCtrlMask | DWORD | Control mask which determines the type and effect of the message output (see separate table). |
msgFmtStr | T_MaxString | Contains the message to be issued (type: T_MaxString). It can contain the formatting code %d for the output of a DINT value at any position. |
dintArg | DINT | Contains the numerical value to be inserted into the message. |
Constant | Description |
---|---|
ADSLOG_MSGTYPE_HINT | Message type is hint. |
ADSLOG_MSGTYPE_WARN | Message type is warning. |
ADSLOG_MSGTYPE_ERROR | Message type is error. |
ADSLOG_MSGTYPE_LOG | Message is written into the log. |
ADSLOG_MSGTYPE_MSGBOX | Message is output in a message box. |
ADSLOG_MSGTYPE_STRING | Message is a directly given string (default). |
The control masks can be ORed in the desired combination.
Example of calling the function in FBD:
![ADSLOGDINT 3:](Images/png/31352971__en-US__Web.png)
The resulting message box:
![ADSLOGDINT 4:](Images/png/9007199286097163__Web.png)
The DINT value 4711 is inserted here into a message. The insertion point is marked by the %d characters in the format string.
Example of calling the function in ST:
PROGRAM MAIN
VAR
rtMessageOutput: R_TRIG; (* Declaration *)
bFeedTooHigh: BOOL;
udiAdsLogRes: UDINT;
END_VAR
rtMessageOutput(CLK := bFeedTooHigh);
IF rtMessageOutput.Q THEN
UdiAdsLogRes := ADSLOGDINT( msgCtrlMask := ADSLOG_MSGTYPE_HINT OR ADSLOG_MSGTYPE_MSGBOX,
msgFmtStr := 'PLC Msg: Feed too high! Current feed: %d', dintArg:= 4711);
END_IF
Requirements
Development environment |
Target system type |
PLC libraries to include (Category group) |
---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86, x64, ARM) |
Tc2_System (System) |