Vous êtes sur la page 1sur 16

Sucosoft S40

Language Elements for


PS4-200, PS4-300 and PS416
08/00 AWB27-1309-GB
Data Types

PS4-200
PS4-300
PS416
Keyword Data type, number of bits and default value
BOOL Boolean number; takes on values 1 or 0 ✓ ✓ ✓
corresponding to “TRUE” or “FALSE”,
1 bit, default value 0
SINT Short integer with value range 128 to +127, ✓ ✓ ✓
8 bit, default value 0
INT Integer; whole number with value range ✓ ✓ ✓
–32768 to +32767, 16 bit, default value 0
DINT Double Integer; double whole number in the – ✓ ✓
value range –2147483648 to +2147483647,
32 bit, default value 0
USINT Unsigned short integer with value range 0 to ✓ ✓ ✓
255, 8 bit, Default value 0
UINT Unsigned Integer; whole number with no sign ✓ ✓ ✓
with the value range 0 to 65535, 16 bit,
default value 0
UDINT Unsigned Double Integer; – ✓ ✓
double whole number with no sign with the
value range 0 to 4294967295,
32 bit, default value 0
REAL Real number, 32 bit, default value 0.0 – ✓ ✓
TIME Time duration, Default value T#0s ✓ ✓ ✓
DATE Calendar date, Default value D#1900-01-01 ✓ ✓ ✓
TIME_ Time, Default value TOD#00:00:00 ✓ ✓ ✓
OF_DAY
DATE_ Date and time, Default value ✓ ✓ ✓
AND_TIME DT#1900-01-01-00:00:00
STRING String of variable length, (empty string) ✓ ✓ ✓
BYTE 8-bit pattern, default value 0 ✓ ✓ ✓
WORD 16-bit pattern, default value 0 ✓ ✓ ✓
DWORD 32-bit pattern, default value 0 – ✓ ✓
Variable Types

Keyword Use

VAR Local variable; only valid within the POU in which it was
declared.
VAR_GLOBAL Global variable that is declared in a program. It is
known in this program and all POUs that were called by
this program. It must be declared as VAR_EXTERNAL in
all invoked POUs.
VAR_EXTERNAL If a global variable is used within an FB, it must be
declared as VAR_EXTERNAL.
VAR_INPUT If a variable is only to be read within a POU (FB, FU), it
must be declared as an input variable.The variable
must not be changed in this POU. Input variables can
be used for transferring parameters in an FU or FB.
VAR_OUTPUT Output variable that is declared in the FB in which it is
supplied as a return value. It is made available for other
POUs.
VAR_IN_OUT An IN_OUT variable is read by the FB, processed and
output under the same name.Since an operation on an
IN_OUT variable has a direct effect on the contents of
the transferred variable, this must not be of a type that
does not permit write operations, (e.g. INPUT or
variable with the attribute CONSTANT).
TYPE Use the keyword “TYPE” to declare derived data types.
These data types are derived from elementary data
types.
Operand Overview

The PLC operands are displayed as directly represented variables.


I Digital input
Q Digital output
M Marker
IA Analog input
QA Analog output
IC Counter input
IS Status data (diagnostics)
SD Data sent to intelligent Suconet K stations
RD Data received from intelligent Suconet K stations
IP 1) Digital input (direct peripheral access)
QP 1) Digital output (direct peripheral access)
IPA 2) Analog input (direct peripheral access)
QPA 2) Analog output (direct peripheral access)
IPC 2) Counter input (direct peripheral access)

1) for PS4-200 and PS4-300


2) only for PS4-300
Operand Overview

Symbols for “Size”

PS4-200
PS4-300
PS416
Symbol Meaning
X or no Bit; Size 1 bit; ✓ ✓ ✓
Symbol Default data type BOOL;
Example: %IX0.0.0.0.0 or %I0.0.0.0.0
B Byte; Size 8 bit; ✓ ✓ ✓
Default data type BYTE;
Example: %IB0.0.0.0
W Word; Size 16 bit; ✓ ✓ ✓
Default data type WORD;
Example: %QW0.0.0.2
D Double word; Size 32 bit; – ✓ ✓
Default data type DWORD;
Example: %QD0.0.0.4

Notation
5-digit notation of Boolean, 4-digit notation of byte and word operands. The
first three digits are reserved for the topology configuration of the PLC
concerned, here shown as 0.0.0.
Examples:
Bit address of input 1.2:

Byte address of output byte 3:


Command Overview

Operator Meaning
LD Copies the operand value to the working register.
LDN Copies the negated operand value to the working register,
operand ANY_BIT.
ST Sets the operand value equal to the current result (CR).
STN Sets the operand value to the negated value of the current
CR, operand ANY_BIT.
S Sets the Boolean operand value to 1 if the CR is 1, Operand
BOOL.
R Resets the Boolean operand value to 0 if the CR is
1, Operand BOOL.
AND Boolean AND, Operand ANY_BIT.
& Boolean AND, Operand ANY_BIT.
ANDN Boolean AND, negated,
Operand ANY_BIT.
&N Boolean AND, negated,
Operand ANY_BIT.
OR Boolean OR, Operand ANY_BIT
ORN Boolean OR, negated, Operand ANY_BIT.
XOR Boolean exclusive OR, Operand ANY_BIT.
XORN Boolean exclusive OR, negated,
Operand ANY_BIT.
ADD Addition, Operands ANY_NUM, TIME, TOD
SUB Subtraction,
Operands ANY_NUM, TIME, TOD
MUL Multiplication, Operand ANY_NUM
DIV Division, Operand ANY_NUM
GT Compare function “greater than”
GE Compare function “greater than equal to”
EQ Compare function “equal to”
NE Compare function “not equal”
LE Compare function “less than equal to”
LT Compare function “less than”
JMP Unconditional jump to label, Operand label.
Command Overview

Operator Meaning
JMPC Jump to label when current result “1”, Operand label.
JMPCN Jump to label with current result “0”, Operand label.
CAL Unconditional call of a function block, Operand
instance name.
CALC Function block call when current result “1”, Operand
instance name.
CALCN Function block call when current result “0”, Operand
instance name.
RET Unconditional return
RETC Return when current result “1”
RETCN Return when current result “0”
Functions

PS4-200
PS4-300
PS416
Function Meaning

❚ Conversion functions
*_TO_* Type conversion of elementary ✓ ✓ ✓
data types
TRUNC Determine integer section of REAL – ✓ ✓
variables

❚ Numeric functions
ABS Absolute value formation ✓ ✓ ✓
NEG Two’s complement ✓ ✓ ✓

❚ Arithmetic functions
ADD Addition of numeric data types ✓ ✓ ✓
Addition of time and date ✓ ✓ ✓
Addition of addresses ✓ ✓ –
MUL Multiplication of numeric data types ✓ ✓ ✓
Multiplication of time – ✓ ✓
Multiplication of addresses ✓ ✓ –
SUB Subtraction of numeric data types ✓ ✓ ✓
Subtraction of time and date ✓ ✓ ✓
Subtraction of addresses ✓ ✓ –
DIV Division of numeric data types ✓ ✓ ✓
Division of time – ✓ ✓
Division of addresses ✓ ✓ –
MOD Remainder division – ✓ ✓

❚ Edge evaluation
IsCarry Test carry bit ✓ ✓ ✓
IsZero Test zero bit ✓ ✓ ✓
IsOverflow Test overflow bit ✓ ✓ ✓
IsPositive Test whether result is positive ✓ ✓ ✓
IsBitTrue x1) Test a bit in the result ✓ ✓ ✓
GetCarryRegister Fetch carry on multiplication or remainder ✓ ✓ ✓
on division

1) x = bit number
Functions

PS4-200
PS4-300
PS416
Function Meaning

❚ Shift functions
SHL n 1) Shift left ✓ ✓ ✓
SHR n 1) Shift right ✓ ✓ ✓
ShiftLeftCarry Shift left with carry ✓ ✓ ✓
ShiftRightCarry Shift right with carry ✓ ✓ ✓
ROL n 1) Rotate left ✓ ✓ ✓
ROR n 1) Rotate right ✓ ✓ ✓

❚ Logic sequences
AND or & Logical AND function ✓ ✓ ✓
ANDN or &N Logical AND, negate ✓ ✓ ✓
OR Logical OR function ✓ ✓ ✓
ORN Logical AND, negate ✓ ✓ ✓
XOR Logical exclusive OR function ✓ ✓ ✓
XORN Logical exclusive OR function, negated ✓ ✓ ✓
NOT Bitwise complement formation ✓ ✓ ✓

❚ Compare functions
GT Compare function “greater than” ✓ ✓ ✓
GE Compare function “greater than or ✓ ✓ ✓
equal to”
EQ Compare function “equal to” ✓ ✓ ✓
LE Compare function “Less than or equal to” ✓ ✓ ✓
LT Compare function “less than” ✓ ✓ ✓
NE Compare function “not equal” ✓ ✓ ✓

❚ OS system functions
PLC_ReadClock Read time element of real-time clock ✓ ✓ ✓
PLC_Message Evaluate message word of PLC, ✓ ✓ ✓
diagnostics

1) n = Shift/rotate parameters
Functions

PS4-200
PS4-300
PS416
Function Meaning

❚ Interrupt functions
Enable_Interrupt Enable interrupt source ✓ ✓ ✓
Disable_Interrupt Disable interrupt source ✓ ✓ ✓

❚ String functions
LEN Determine string length ✓ ✓ ✓
CONCAT Concatenation of strings – ✓ ✓
Concatenation of time and date
DELETE Delete n characters from a string – ✓ ✓
FIND Find a string within a string – ✓ ✓
INSERT Insert a string in a string – ✓ ✓
LEFT Select n leftmost characters of a string – ✓ ✓
MID Sections of a string – ✓ ✓
REPLACE Replace characters in a string – ✓ ✓
RIGHT Select n rightmost characters of a string – ✓ ✓

❚ Selection functions
LIMIT Value limitation – ✓ ✓
MAX Maximum selection – ✓ ✓
MIN Minimum selection – ✓ ✓
MUX Multiplexer – ✓ ✓
SEL Conditional operand selection – ✓ ✓
Function Blocks

PS4-200
PS4-300
PS416
Function block Meaning
❚ Edge evaluation
F_TRIG Edge evaluation, falling edge ✓ ✓ ✓
R_TRIG Edge evaluation, rising edge ✓ ✓ ✓
❚ Flipflops
RS RS flipflop ✓ ✓ ✓
SR SR flipflop ✓ ✓ ✓
❚ Date and time
GetRealTimeClock Evaluate real-time clock ✓ ✓ ✓
RealTimeClock Compare real-time clock ✓ ✓ ✓
RTC Set real-time clock ✓ ✓ ✓
SetRealTimeClock Set real-time clock ✓ ✓ –
DATconcat Concatenation of date ✓ ✓ ✓
and time
DATsplit Split data type DT ✓ ✓ ✓
DateConcat Concatenation of date ✓ ✓ ✓
DateSplit Split data type DATE ✓ ✓ ✓
TimeConcat Concatenation of time duration ✓ ✓ ✓
TimeSplit Split data type TIME ✓ ✓ ✓
TODconcat Concatenation of time ✓ ✓ ✓
TODsplit Split of data type TOD ✓ ✓ ✓
❚ Timer function blocks
MS_TimeFalling Off-delay timer, milliseconds ✓ ✓ ✓
MS_TimeRising On-delay timer, milliseconds ✓ ✓ ✓
S_TimeFalling Off-delay timer, seconds ✓ ✓ ✓
S_TimeRising On-delay timer, milliseconds ✓ ✓ ✓
TimeGenerator Clock generator ✓ ✓ ✓
TimePulse Pulse timer ✓ ✓ ✓
TOF Off-delay timer ✓ ✓ ✓
Function Blocks

PS4-200
PS4-300
PS416
Function block Meaning
❚ ... Timer function blocks
TON On-delay timer ✓ ✓ ✓
TP Pulse ✓ ✓ ✓
❚ Alarm function blocks
CAlarm Counter alarm function block – – ✓
FAlarm Edge alarm function block – – ✓
TAlarm Timer alarm function block – – ✓
CounterAlarm Counter alarm function block ✓ ✓ –
EdgeAlarm Edge alarm function block ✓ ✓ –
TimerAlarm Timer alarm function block ✓ ✓ –
❚ Counter and comparator function blocks
_16BitCounter 16-bit up/down counter ✓ ✓ ✓
_32BitCounter 32-bit up/down counter – ✓ ✓
CTD Down counter ✓ ✓ ✓
CTU Up counter ✓ ✓ ✓
CTUD Up/down counter ✓ ✓ ✓
_16Bit_Compare 16-bit comparator ✓ ✓ ✓
_32Bit_Compare 32-bit comparator – ✓ ✓
CounterLE Function block for addressing ✓ ✓ –
the Counter LE
SSIEncoder Absolute encoder – ✓ –
IncEncoder Incremental encoder – ✓ –
❚ Register function blocks
SRB_x1) 1-bit shift register ✓ ✓ ✓
SRB_x1) 8-bit shift register ✓ ✓ ✓
SRW_x1) 16-bit shift register ✓ ✓ ✓
LifoBx1) 8-bit LIFO register ✓ ✓ ✓
LifoWx1) 16-bit LIFO register ✓ ✓ ✓
FifoBx1) 8-bit FIFO register ✓ ✓ ✓
FifoWx1) 16-Bit-FiFo-Register ✓ ✓ ✓
1) “x” stands for variable register depth
Function Blocks

PS4-200
PS4-300
PS416
Function block Meaning
❚ Code conversion
_16BitBinaryToBCD 16-bit binary/decimal code converter ✓ ✓ ✓
_32BitBinaryToBCD 32-bit binary/decimal code converter – ✓ ✓
BCDTo16BitBinary 16-bit decimal/binary code converter ✓ ✓ ✓
BCDTo32BitBinary 32-bit decimal/binary code converter – ✓ ✓
❚ Array operations
CompareArray Compare arrays ✓ ✓ ✓
TransferArray Transfer arrays ✓ ✓ ✓
BlockCompare Data block comparison or search for ✓ ✓ –
values
BlockTransfer Copy or initialise data blocks ✓ ✓ –
Serialize Transfer data structures to an array ✓ ✓ ✓
Deserialize Transfer array to data structures ✓ ✓ ✓
❚ String processing
ADRtoSTR Copy marker range to a string ✓ ✓ –
STRtoADR Copy string to a marker range ✓ ✓ –
COMtoSTR Convert array to string ✓ ✓ ✓
STRtoCOM Convert string to array ✓ ✓ ✓
❚ Sequential control function block
SFC_x Sequential control function block for ✓ ✓ –
sequence control
Function Blocks

PS4-200
PS4-300
PS416
Function block Meaning
❚ Communications function blocks
SCO Serial communication function block ✓ ✓ –
COM Serial communication – – ✓
DialOrHangup Establishing and aborting the – ✓ ✓
connection via modem
SendATCommand Send AT commands to a modem – ✓ ✓
SUCOM_A Emulation of the programming – ✓ ✓
protocol
MOD200 MODBUS communication – ✓ ✓
ASi_PARAM ASI slave configuration ✓ ✓ –
PSCO PROFIBUS-FMS with LE4-503-BS1 ✓ ✓ –
SuconetP PROFIBUS-FMS with PS416-NET-230 – – ✓
SuconetS_BGKS INTERBUS Communication – – ✓
PdpStationDiag Profibus DP communication – ✓ ✓
PdpFreezeSync PROFIBUS-DP control commands – ✓ ✓
PdpAcyclicReadWrite1) PROFIBUS-DPV1, – ✓ ✓
acyclic communication
DE4netDP DF4 frequency inverter – ✓ ✓
DE4netK DF4 frequency inverter ✓ ✓ ✓
MI4netK MI4 communications function block ✓ ✓ ✓
MI4K MI4 communications function block ✓,# ✓,# –
❚ Read and write memory card
ReadMC Read out data from memory card ✓ ✓ ✓
WriteMC Save data on memory card ✓ ✓ ✓
ReloadData Read out data from memory card ✓ ✓ –
SaveData Save data on memory card ✓ ✓ –
SetMCFileLength Store and initialise file on – – ✓
memory card

# For explanation, see AWB2700-1306-GB, Chapter 6.


1) from S40, version 4.2
Function Blocks

PS4-200
PS4-300
PS416
Function block Meaning
❚ OS system functions
PS_ApplicationHalt Stop user program – ✓ ✓
PS_ClearKOMBit Acknowledge communication error – – ✓
PS_Diagnostic PS diagnostics words – – ✓
PS_GetDateAndTime Access to real time clock – ✓ ✓
❚ ...OS system functions
PS_Message PS information message words – – ✓
PS_SwitchPosition PS status words – ✓ ✓
PS_ReadOSInfo Scan operating system version ✓ ✓ ✓
ColdstartRetention Definition of a marker range for – – ✓
retaining data, also during cold starts
CPUDataExchange Data exchange between CPUs – – ✓
❚ Peripheral access
ReadDirect Direct reading of digital inputs – – ✓
WriteDirect Direct writing to digital outputs – – ✓
ReadAnalogDirect Direct reading of analog inputs – – ✓
WriteAnalogDirect Direct writing to analog outputs – – ✓
ReadCounterDirect Direct reading of counter inputs – – ✓
❚ Conversion functions
DataScale Scaling of data ✓ ✓ ✓
PTtoCelsius Linearisation of PT1000 values ✓ – –
PTtoFahrenheit Linearisation of PT1000 values ✓ – –
NItoCelsius Linearisation of NI1000 values ✓ – –
NItoFahrenheit Linearisation of NI1000 values ✓ – –
IEEE_to_Real Number conversion – ✓ ✓
Real_to_IEEE Number conversion – ✓ ✓
Moeller GmbH, 53105 Bonn
08/00 AWB27-1309-GB BD-M/Ki
Printed in the Federal Republic of Germany (08/00)

08/00 AWB27-1309-GB BD-M/Ki

Vous aimerez peut-être aussi