ADSLOGLREAL
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. 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 created format string must contain the string '%f' at the desired position. Please keep in mind that also here, as shown in the sample, the function must be called using edge-control (see also description ADSLOGDINT). The return parameter contains the function error code, or 0 if successful.
FUNCTION ADSLOGLREAL : DINT
VAR_INPUT
msgCtrlMask : DWORD;
msgFmtStr : T_MaxString;
lrealArg : LREAL;
END_VAR
msgCtrlMask : Control mask which determines the type and effect of the message output. Listing of all the control masks for message output currently implemented as global constants in the library (see description of the function ADSLOGDINT).
msgFmtStr : Contains the message to be issued. It can contain the formatting code ‘%d’ for the output of a DINT value at any position.
lrealArg : Contains the numerical value to be inserted into the message.
Example of calling the function in FBD:

The resulting message box
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:
rtMessageOutput: R_TRIG; (* Declaration*)
bTemperatureTooHigh: BOOL;
udiAdsLogRes: UDINT;
(*--------------------------------------*)
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 platform | PLC libraries to include |
---|---|---|
TwinCAT v2.7.0 | PC or CX (x86) | PLCSystem.Lib |
TwinCAT v2.8.0 | PC or CX (x86) | TcSystem.Lib |
TwinCAT v2.10.0 Build >= 1301 | CX (ARM) | TcSystem.Lib |