ADSLOGLREAL

ADSLOGLREAL 1:

When called, the function outputs a message box with a predefinable text to the screen and writes an entry to the system's event log. An LREAL value (floating-point number) can be incorporated into the text to be output at a position specified by the user. For this purpose, the created format string must contain the string '%f' at the desired position. Please keep in mind that the function must be called edge-triggered (see also note in description ADSLOGDINT). The return parameter contains the function error code, or 0 if successful.

FUNCTION ADSLOGLREAL : DINT

ADSLOGLREAL 2: Inputs

VAR_INPUT
    msgCtrlMask : DWORD;
    msgFmtStr   : T_MaxString;
    lrealArg    : LREAL;
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 output. It can contain the formatting code %f for the output of a LREAL value at any position.

Information: The length of the message is limited to 253 bytes (corresponds to 253 characters for strings in standard format).

lrealArg

LREAL

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.
Information: This functionality is not available for Windows CE.

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:

ADSLOGLREAL 3:

The resulting message box:

ADSLOGLREAL 4:

Here the LREAL value 187.203045 is inserted into a message. The insertion point is marked by the %f characters in the format string. The number is truncated after the sixth decimal point during output.

Example of calling the function in ST:

PROGRAM MAIN
VAR
    rtMessageOutput: R_TRIG; (* Declaration *)
    bTemperatureTooHigh: BOOL;
    udiAdsLogRes: UDINT;
END_VAR

rtMessageOutput(CLK := bTemperatureTooHigh);
IF rtMessageOutput.Q THEN 
    udiAdsLogRes := ADSLOGLREAL( msgCtrlMask := ADSLOG_MSGTYPE_HINT OR ADSLOG_MSGTYPE_MSGBOX, msgFmtStr := 'PLC Msg.: Max Temp. reached ! Temperature: %f', lrealArg := 187.203045);
END_IF;

Prerequisites

Development Environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, Arm®)

Tc2_System (system)