ADSLOGLREAL

ADSLOGLREAL 1:

This function issues when called a message box holding a specifiable text on the screen, and writes an entry into the system's log. In the text to be output, a LREAL value (floating point number) can be inserted at a point specified by the user. For this purpose the stored format string must contain the characters %f at the desired location. Always remember that here too, as illustrated in the example, the function must be called using edge-control (see also the note in the description of ADSLOGDINT). The return value contains the function error code, or, if successful, 0.

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). Listing of all the control masks for message output currently implemented as global constants in the library (see description of the function ADSLOGDINT).

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.

lrealArg

LREAL

Contains the numerical value to be inserted into the message.

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;

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)