meta data for this page
  •  

LamaPLC: Simatic S7 SCL commands with examples

Simatic S7 SCL commands with examples

- The chapter is not finished yet. I am still working on the (black) Instructions without links. - Vamos 06.06.2023



SCL is the most effective programming language for Simatic systems. It is high-level, suitable for cycle organization, the use of CASE structures, its code can be edited with an external editing program or created with external generators.

Instruction / CommandType of opUsagePropertiesNote
positive / negative edge monitoringbit-logicsummary of edge monitoring--
R_TRIGbit-logicdetect positive signal edgeDetect positive signal edge-
F_TRIGbit-logicdetect negative signal edgeDetect negative signal edge-
ABSmathabsolute valueValue of the “ABS” (absolute value) math function-
COS/ACOSmathcosinevalue of the “COS” (cosie) trigonometric function-
ACOSmatharccosinevalue of the “ACOS” (arccosine) trigonometric function-
EXPmathexponentialValue of the “EXP” (exponent from the base e (e = 2.718282)) math function-
FRACmathfractalValue of the “FRAC” (fraction) math function-
LIMITmathset limitLimits the value of the parameter-
LNmathnatural logarithmValue of the “LN” (natural logarithm to the base e (e = 2.718282)) math function-
MAXmathget maximumGet maximum of maximum 32 inputs-
MINmathget minimumGet minimum of maximum 32 inputs-
SINmathsinusValue of the “SIN” (sinus) trigonometric function-
ASINmatharcsineValue of the “ASIN” (arcsine) trigonometric function-
SQRmathsquareValue of the “SQR” (square) math function-
SQRTmathsquare rootValue of the “SQRT” (square root) math function-
TANmathtangentvalue of the “TAN” (tangent) trigonometric function-
ATANmatharctangentvalue of the “ATAN” (arctangent) trigonometric function-
IEC timerstimer/counterSummary IEC timer FBs-
TONtimer/counterGenerate on-delay)The TON “switch-on delay” function-
TOFtimer/counterGenerate off-delay)The TOF “switch-off delay” function-
TPtimer/counterGenerate pulse)The TP “pulse generator” function-
TONRtimer/counterTime accumulator)The TONR “time accumulator” function-
CTUtimer/countercount upThe function that only counts upwards-
CTDtimer/countercount downThe function that only counts downwards-
CTUDtimer/countercount up and downThe function that counts up- and downwards-
ROUNDconversionRoundingRound numerical value-
CEILconversionround upGenerate next higher integer from floating-point number-
FLOORconversionround downGenerate next lower integer from floating-point number-
TRUNCconversionTruncateTruncate numerical value-
SCALE_XconversionScale--
NORM_XconversionNormalize--
SCALEconversionScale--
RUNTIMEruntimemeasures the runtimeThe “RUNTIME” instruction measures the runtime of the entire program, individual blocks or command sequencesonly S7-1500
MOVEmoveCopy value- Copies the content of the parameter on the input IN to the parameter of the output OUT.
- The parameters on the input and output must be of the same data type.
- Parameters can also be structured tags (PLC data types).
- Copies complete arrays and structures.
-
BLKMOVmovemove pointer block- Move the content of a memory area (source area) to another memory area (destination area)-
MOVE_BLKmovemove array block- Copies the content of an array to another array.
- Source and target array must be of the same data type.
- Copies complete arrays and structures.
- Copies several array elements with structures as well. In addition, start and number of elements can be specified.
-
UMOVE_BLKmoveCopies array without interruption- Copies the content of an array consistently without the risk of the OB interrupting the copying process.
- Source and target array must be of the same data type.
-
MOVE_BLK_VARIANTmoveCopy arrayCopies one or several structured tag(s) (PLC data types)
- Recognizes data types at runtime
- Supplies detailed error information
- Apart from the elementary and structured data types, PLC data types, arrays, and array DBs are also supported.
-
Serializemoveconverts structured data into a byte array- Several data records can be combined into a single byte array and, for example, be sent to other devices as a message frame.
- Input and output parameters can be transferred as data type Variant.
S7-1500 or
S7-1200 > FW4.1
Deserializemoveconverts one byte array into one or several structure/s- Application case I-Device: The I device receives several data records in the input area which are copied to different structures.
- Several data records can be combined into a single byte array. Deserialize enables copying these to different structures.
S7-1500 or
S7-1200 > FW4.1
FILL_BLKmoveFill a memory area- The instruction can only be executed if the source range and the target range have the same data type
- The maximum number of elements changed is the number of elements in the ARRAY or structure
S7-1500 or
S7-1200 > FW4.1
UFILL_BLKmoveFill block uninterruptible- The instruction can only be executed if the source range and the target range have the same data type
- The maximum number of elements changed is the number of elements in the ARRAY or structure
- The instruction cannot be interrupted
S7-1500 or
S7-1200 > FW4.1
SCATTERmoveParse the bit sequence into individual bits- BYTE, WORD, DWORD or LWORD data type into individual bits and saves them in an ARRAY of BOOL, an anonymous STRUCT or a PLC data type exclusively with Boolean elementsS7-1500 or
S7-1200 > FW4.1
SCATTERmoveParse the bit sequence into individual bits- BYTE, WORD, DWORD or LWORD data type into individual bits and saves them in an ARRAY of BOOL, an anonymous STRUCT or a PLC data type exclusively with Boolean elementsS7-1500 or
S7-1200 > FW4.1
SCATTER_BLKmoveParse elements of an ARRAY of bit sequence into individual bits- parses one or more elements of an ARRAY of BYTE, WORD, DWORD or LWORD into individual bits and saves them in an ARRAY of BOOL, an anonymous STRUCT or a PLC data type exclusively with Boolean elementsS7-1500 or
S7-1200 > FW4.1
GATHERmoveMerge individual bits into a bit sequenceMerges the bits from an ARRAY of BOOL, an anonymous STRUCT or a PLC data type exclusively with Boolean elements into a bit sequence. The bit sequence is saved in a tag of the data type BYTE, WORD, DWORD or LWORDS7-1500 or
S7-1200 > FW4.1
GATHER_BLKmoveMerge individual bits into multiple elements of an ARRAY of bit sequenceMerges the bits from an ARRAY of BOOL, an anonymous STRUCT or a PLC data type exclusively with Boolean elements into one or multiple elements of an ARRAY of <bit sequence>S7-1500 or
S7-1200 > FW4.1
SWAPmoveSwap; change the arrangementChange the arrangement of the bytes of an input value and save the result in the specified operandS7-1500 or
S7-1200 > FW4.1
ReadFromArrayDBmoveRead from array data blockRead the element from a data block of the ARRAY DB block type to which the index references, and write the value of the element to the target rangeS7-1500 or
S7-1200 > FW4.1
WriteToArrayDBmoveWrite to array data blockWrite the element to which the index references to a data block of the ARRAY DB block typeS7-1500 or
S7-1200 > FW4.1
ReadFromArrayDBLmoveRead from array data block in load memoryRead the element ti which the index references from a data block of the ARRAY DB block type in the load memory and write it to the target rangeS7-1500 or
S7-1200 > FW4.1
WriteToArrayDBLmoveWrite to array data block in load memoryWrite the element to which the index references to a data block of the ARRAY DB block type in load memoryS7-1500 or
S7-1200 > FW4.1
PEEKmoveRead memory addressRead a memory address from a standard memory area without specifying a data typeS7-1500 or
S7-1200 > FW4.1
PEEK_BOOLmoveRead memory bitRead a memory bit from a standard memory area without specifying a data typeS7-1500 or
S7-1200 > FW4.1
POKEmoveWrite memory addressWrite a memory address to a standard memory area without specifying a data typeS7-1500 or
S7-1200 > FW4.1
POKE_BOOLmoveWrite memory bitWrite a memory bit to a standard memory area without specifying a data typeS7-1500 or
S7-1200 > FW4.1
POKE_BLKmoveWrite memory areaWrite a memory area to a different standard memory area without specifying a data typeS7-1500 or
S7-1200 > FW4.1
READ_LITTLEmoveRead data in little endian formatRead data from a memory area and to write this to a single tag in the little endian byte sequenceS7-1500 or
S7-1200 > FW4.1
WRITE_LITTLEmoveWrite data in little endian formatWrite the data of a single tag in the little endian byte sequence to a memory areaS7-1500 or
S7-1200 > FW4.1
READ_BIGmoveRead data in big endian formatRead data from a memory area and to write this to a single tag in the big endian byte sequenceS7-1500 or
S7-1200 > FW4.1
WRITE_BIGmoveWrite data in big endian formatWrite the data of a single tag in the big endian byte sequence to a memory areaS7-1500 or
S7-1200 > FW4.1
VariantGetvariantRead valueThis instruction enables you to read the value of a tag pointing to a VARIANT.S7-1500 or
S7-1200 > FW4.1
VariantPutvariantWrite valueThis instruction enables you to write the value of a tag pointing to a VARIANT.S7-1500 or
S7-1200 > FW4.1
CountOfElementsvariantCounting elementsWith this instruction you poll the number of ARRAY elements of a tag pointing to a VARIANTS7-1500 or
S7-1200 > FW4.1
TypeOf()variantDetermining the data typeUse this instruction to poll the data type of a tag pointing to a VARIANTonly SCL
S7-1500 or
S7-1200 > FW4.1
TypeOfElements()variantDetermining the array data typeUse this instruction to poll the data type of the ARRAY elements of a tag pointing to a VARIANT.only SCL
S7-1500 or
S7-1200 > FW4.1
VARIANT_TO_DB_ANYvariantDetermining the data block numberThis instruction queries the data block number of an instance data block of a PLC data type, system data type or array DB.only SCL
S7-1500 or
S7-1200 > FW4.1
DB_ANY_TO_VARIANTvariantCreated from a data block of a variant tag.This instruction creates the variant tag of an instance data block of a PLC data type, system data type or array DBonly SCL
S7-1500 or
S7-1200 > FW4.1




This page has been accessed for: Today: 1, Until now: 40