Siemens S7 Libraries
Siemens S7 Libraries
Siemens S7 Libraries
used for data transfer in the CP modes PROFINET IO controller or PROFINET IO device.
used to receive data in the CP modes PROFINET IO controller or PROFINET IO device.
Establish an FTP connection
Store a file on the FTP server
Retrieve a file from the FTP server
Delete a file on the FTP server
Enable an FTP connection
data by means of a configured connection to the communication partner.
data by means of a configured connection from the communication partner (not email).
Query a connection status for S7-300
Lead/Lag Algorithm
Discrete Control Alarm Timer
Motor Control Alarm Timer
Index Matrix Compare
Scan Matrix Compare
Event Maskable Drum
Pack Data
Software Timer On Delay—Retentive
Indirect Block Move
Reset Range of Outputs
Set Range of Outputs
Add to Table
First In/First Out Unload Table
Table Find
Last In/First Out Unload Table
Table
Move Table to Word
Word Shift Register
Word to Table
Bit Shift Register
Seven Segment Decoder
ASCII to Hex
Hex to ASCII
Encode Binary Position
Decode Binary Position
Ten’s Complement
Sum Number of Bits
Reset Range of Immediate Outputs
Set Range of Immediate Outputs
Standard Deviation
Correlated Data Table
Table to Table
Scaling Values
Unscaling Values
supports the summertime/wintertime changeover in CPUs that do not have the time status. For this purpose it sets the CPU c
supports the summertime/wintertime changeover in CPUs that do have the time status. For this purpose it sets the time status
transfers the time-stamped messages of an IM153-2 into its instance DB.
reads the time status or time of the CPU and calculates the local time. It is therefore only useful on CPUs with time status.
calculates the local time from the base time given at the input.
calculates the base time from the local time given at the input.
sets the required time interrupt to the preset time. This time is given in local time.
ose it sets the CPU clock to the current time and according to the changeover rules in the Control DB.
it sets the time status to the current time and according to the changeover rules in the Control DB.
used for data transfer in the CP modes PROFINET IO controller or PROFINET IO device.
used to receive data in the CP modes PROFINET IO controller or PROFINET IO device.
Establish an FTP connection
Store a file on the FTP server
Retrieve a file from the FTP server
Delete a file on the FTP server
Enable an FTP connection
data by means of a configured connection to the communication partner.
data by means of a configured connection from the communication partner (not email).
Query a connection status for S7-300
Create a Data Block in the Load Memory
Read from a Data Block in Load Memory
Write from a Data Block in Load Memory
Read OB Start Information
Create Data Block
Delete Data Block
Test Data Block
Compress the User Memory
Create a Data Block
Read Diagnostic Data of a DP Slave (Slave Diagnostics)
Mask Synchronous Errors
Unmask Synchronous Errors
Read Error Register
Transfer Substitute Value to Accumulator 1
Read a System Status List or Partial List
Write a User-Defined Diagnostic Event to the Diagnostic Buffer
Determine OB program runtime
Reading a Data Record
Writing a Data Record
Receiving an Interrupt
Send interrupt to DP master
Trigger a Hardware Interrupt on the DP Master
Synchronize Groups of DP Slaves
Deactivation and activation of DP slaves
Read Consistent Data of a Standard DP Slave
Write Consistent Data to a DP Standard Slave
Identifying the bus topology in a DP master system
Control Operation in H Systems
Continuous Control
Step Control
Pulse Generation
Position (integrated function) (only exist on the CPU 314 IFM)
Continuous Control (only exist on the CPU 314 IFM)
Step Control (only exist on the CPU 314 IFM)
Pulse Generation (only exist on the CPU 314 IFM)
Point Math Add duration to a time
Combine two STRING variables
Combine DATE and TIME_OF_DAY to DT
Delete in a STRING variable
Data type conversion DINT to STRING
Extract the DATE from DT
Extract the day of the week from DT
Extract the TIME_OF_DAY from DT
Compare DT for equal
Compare STRING for equal
Find in a STRING variable
Compare DT for greater than or equal
Compare STRING for greater than or equal
Compare DT for greater than
Compare STRING for greater than
Data type conversion INT to STRING
Insert in a STRING variable
Compare DT for smaller than or equal
Compare STRING for smaller than or equal
Left part of a STRING variable
Length of a STRING variable
Point Math Limit
Compare DT for smaller than
Compare STRING for smaller than
Point Math Select maximum
Middle part of a STRING variable
Point Math Select minimum
Compare DT for unequal
Compare STRING for unequal
Data type conversion REAL to STRING
Replace in a STRING variable
Right part of a STRING variable
Data type conversion S5TIME to TIME
Point Math Subtract two time values
Point Math Subtract duration from a time
Point Math Binary selection
Data type conversion STRING to DINT
Data type conversion STRING to INT
Data type conversion STRING to REAL
Data type conversion TIME to S5TIME
Count Up
Count Down
Count Up/Down
Generate a Pulse
Generate an On Delay
Generate an Off Delay
Read All Inputs of a DP Standard Slave/PROFINET IO Device
Write All Outputs of a DP Standard Slave/PROFINET IO Device
Read a Part of the Inputs of a DP Standard Slave/PROFINET IO Device
Write a Part of the Outputs of a DP Standard Slave/PROFINET IO Device
Read Predefined Parameter
Query Logical Address of a Channel
Update the Process Image Update Table
Update the Process Image Output Table
Query the Module Slot Belonging to a Logical Address
Query all Logical Addresses of a Module
Read Defined Parameters
Write Dynamic Parameters
Write Default Parameters
Assign Parameters to a Module
Write a Data Record
Read a Data Record
Determine Start Address of a Module
Determine the Slot Belonging to a Logical Address
Redefined Parameters
Update process image partition input table in synchronous cycle
Update process image partition output table in synchronous cycle
Disable New Interrupts and Asynchronous Errors
Enable New Interrupts and Asynchronous Errors
Delay Higher Priority Interrupts and Asynchronous Errors
Enable Higher Priority Interrupts and Asynchronous Errors
Standard Deviation
Pack Data
Indirect Block Move
Copy Variables
Initialize a Memory Area
Uninterruptible Block Move
Set Time-of-Day Interrupt
Cancel Time-of-Day Interrupt
Activate Time-of-Day Interrupt
Query Time-of-Day Interrupt
Start Time-Delay Interrupt
Cancel Time-Delay Interrupt
Query Time-Delay Interrupt
Trigger Multicomputing Interrupt
Re-trigger Cycle Time Monitoring
Change the CPU to STOP
Delay Execution of the User Program
Controlling CiR
Assembly Code Block (only exists for CPU 614)
Generate Acknowledgeable Block-Related Messages
Generate Permanently Acknowledged Block-Related Messages
Query the Acknowledgment Status of the last ALARM_SQ Entering State Message
Reading Dynamic System Resources
Deleting Dynamic System Resources
Generating Always Acknowledgeable and Block-Related Messages
Generating Always Acknowledgeable and Block-Related Messages
Update inputs in the user program interface of PROFInet components
Update outputs in the user program interface of PROFInet components
Update DP interconnections
Change fixed point number to floating point number
Change floating point number to fixed point number
Add floating point numbers
Subtract floating point numbers
Multiply floating point number
Divide floating point numbers
Compare floating point numbers
Extract root of floating point numbers
Clock generator
Clock generator (timing element)
Message of first value with single flashing light, wordwise, A
Message of first value with double flashing light, wordwise, A
Collected message, wordwise (sound alert)
Collected message, bitwise
Message of first value with single flashing light, bitwise, A
Message of first value with double flashing light, wordwise, A+M
Message of first value with single flashing light, bitwise, A+M
Message of first value with double flashing light, bitwise, A+M
Change BCD number to 16 bit dual number
Change 16 bit dual number to BCD number
Multiply 16 bit dual numbers
Divide 16 bit dual numbers
Add 32 bit dual numbers
Subtract 32 bit dual numbers
Multiply 32 bit dual numbers
Divide 32 bit dual numbers
Extract roots of 16 bit dual numbers
Bi-directional shift register, bitwise
Bi-directional shift register, wordwise
Buffer memory (FIFO)
Stack register (LIFO)
Copy data block, direct assignment of parameters
Copy data block, indirect assignment of parameterization
Save scratchpad memory
Load scratchpad memory
Change BCD number to 32 bit dual number
Change 32 bit dual number to BCD number
Read analog value
Read analog value
Read analog value
Read analog value
Read analog value
Read analog value
Read analog value
Read analog value
Output analog value
Output analog value
Read and Write for extended periphery (direct assignment of parameters)
Read and Write for extended periphery (indirect assignment of parameters)
Sine (x)
Cosine (x)
Tangent (x)
Cotangent (x)
Arc sine (x)
Arc cosine (x)
Arc tangent (x)
Arc cotangens (x)
Natural logarithm ln (x)
Decade logarithm Iog (x)
General logarithm Iog (x) to basis b
e to the power of n
10 to the power of n
AKKU 2 to the power of AKKU 1
Word Shift Register
Bit Shift Register
Add to Table
First In/First Out Unload Table
Table Find
Last In/First Out Unload Table
Table
Move Table to Word
Word to Table
Correlated Data Table
Table to Table
Positioning with Analog Output (only exist on the S7-300C CPUs)
Positioning with Digital Output (only exist on the S7-300C CPUs)
Controlling the Counter (only exist on the S7-300C CPUs)
Controlling the Frequency Measurement (only exist on the S7-300C CPUs)
Controlling Pulse Width Modulation (only exist on the S7-300C CPUs)
Sending Data (ASCII, 3964(R)) (only exist on the S7-300C CPUs)
Receiving Data (ASCII, 3964(R)) (only exist on the S7-300C CPUs)
Deleting the Receive Buffer (ASCII, 3964(R)) (only exist on the S7-300C CPUs)
Sending Data (RK 512) (only exist on the S7-300C CPUs)
Fetching Data (RK 512) (only exist on the S7-300C CPUs)
Receiving and Providing Data (RK 512) (only exist on the S7-300C CPUs)
supports the summertime/wintertime changeover in CPUs that do not have the time status. For this purpose it sets the CPU c
supports the summertime/wintertime changeover in CPUs that do have the time status. For this purpose it sets the time status
transfers the time-stamped messages of an IM153-2 into its instance DB.
reads the time status or time of the CPU and calculates the local time. It is therefore only useful on CPUs with time status.
calculates the local time from the base time given at the input.
calculates the base time from the local time given at the input.
sets the required time interrupt to the preset time. This time is given in local time.
Discrete Control Alarm Timer
Motor Control Alarm Timer
Event Maskable Drum
Software Timer On Delay—Retentive
Implement a Sequencer
ose it sets the CPU clock to the current time and according to the changeover rules in the Control DB.
it sets the time status to the current time and according to the changeover rules in the Control DB.
SFB 52 RDREC DP
SFB 53 WRREC DP
SFB 54 RALRM DP
SFB 60 SEND_PTP TEC_FUNC
SFB 61 RECV_PTP TEC_FUNC
SFB 62 RES_RECV TEC_FUNC
Siemens S7 System Function Blocks
SFB 75 SALRM DP
SFB 81 RD_DPAR IO_FUNCT
Siemens S7 System Function Blocks
Count Up
Count Down
Count Up/Down
Generate a Pulse
Generate an On Delay
Generate an Off Delay
Uncoordinated Sending of Data
Uncoordinated Receiving of Data
Sending Segmented Data
Receiving Segmented Data
Read Data from a Remote CPU
Write Data to a Remote CPU
Send Data to Printer
Initiate a Warm or Cold Restart on a Remote Device
Changing a Remote Device to the STOP State
Initiate a Hot Restart on a Remote Device
Query the Status of a Remote Partner
Receive the Status of a Remote Device
Counter (high-speed counter, integrated function) (only exist on the
CPU 312 IFM and CPU 314 IFM)
Frequency Meter (frequency meter, integrated function (only exist on
the CPU 312 IFM and CPU 314 IFM)
Generating block related messages without acknowledgement
indication
Implement a Sequencer
Generate Block-Related Messages with Acknowledgment Display
Generate Block-Related Messages without Values for 8 Signals
Generate Block-Related Messages with Values for 8 Signals
Generate Block-Related Messages without Acknowledgment Display
SFC 10 DIS_MSG COM_FUNC Disable Block-Related, Symbol-Related and Group Status Messages
- 49 -
Siemens S7 System Function Calls
SFC 66 X_RCV COM_FUNC Receive Data from a Communication Partner outside the Local S7
Station
SFC 67 X_GET COM_FUNC Read Data from a Communication Partner outside the Local S7
Station
SFC 68 X_PUT COM_FUNC Write Data to a Communication Partner outside the Local S7 Station
SFC 69 X_ABORT COM_FUNC Abort an Existing Connection to a Communication Partner outside the
Local S7 Station
SFC 70 GEO_LOG IO_FUNCT Determine Start Address of a Module
SFC 71 LOG_GEO IO_FUNCT Determine the Slot Belonging to a Logical Address
SFC 72 I_GET COM_FUNC Read Data from a Communication Partner within the Local S7 Station
SFC 73 I_PUT COM_FUNC Write Data to a Communication Partner within the Local S7 Station
SFC 74 I_ABORT COM_FUNC Abort an Existing Connection to a Communication Partner within the
Local S7 Station
SFC 78 OB_RT DIAGNSTC Determine OB program runtime
SFC 79 SET BIT_LOGC Set a Range of Outputs
SFC 80 RSET BIT_LOGC Reset a Range of Outputs
SFC 81 UBLKMOV MOVE Uninterruptible Block Move
SFC 82 CREA_DBL DB_CTRL Create a Data Block in the Load Memory
SFC 83 READ_DBL DB_CTRL Read from a Data Block in Load Memory
SFC 84 WRIT_DBL DB_CTRL Write from a Data Block in Load Memory
SFC 85 CREA_DB DB_FUNCT Create a Data Block
SFC 87 C_DIAG COM_FUNC Diagnosis of the Actual Connection Status
SFC 90 H_CTRL HF_FUNCT Control Operation in H Systems
SFC 100 SET_CLKS CLK_FUNC Setting the Time-of-Day and the TOD Status
SFC 101 RTM CLK_FUNC Handling runtime meters
SFC 102 RD_DPARA IO_FUNCT Redefined Parameters
SFC 103 DP_TOPOL DP Identifying the bus topology in a DP master system
SFC 104 CIR PGM_CNTL Controlling CiR
SFC 105 READ_SI PMC_FUNC Reading Dynamic System Resources
SFC 106 DEL_SI PMC_FUNC Deleting Dynamic System Resources
- 50 -
Siemens S7 System Function Calls
SFC 107 ALARM_DQ PMC_FUNC Generating Always Acknowledgeable and Block-Related Messages
SFC 108 ALARM_D PMC_FUNC Generating Always Acknowledgeable and Block-Related Messages
SFC 112 PN_IN PROFIne2 Update inputs in the user program interface of PROFInet components
SFC 113 PN_OUT PROFIne2 Update outputs in the user program interface of PROFInet
components
SFC 114 PN_DP PROFIne2 Update DP interconnections
SFC 126 SYNC_PI IO_FUNCT Update process image partition input table in synchronous cycle
SFC 127 SYNC_PO IO_FUNCT Update process image partition output table in synchronous cycle
- 51 -
Siemens S7 S5-S7 Converting Blocks
FC 79 MLD_EZK S5_CNVRT Message of first value with single flashing light, bitwise, A+M
FC 80 MLD_EDK S5_CNVRT Message of first value with double flashing light, bitwise, A+M
FC 81 COD_B4 S5_CNVRT Change BCD number to 16 bit dual number
FC 82 COD_16 S5_CNVRT Change 16 bit dual number to BCD number
FC 83 MUL_16 S5_CNVRT Multiply 16 bit dual numbers
FC 84 DIV_16 S5_CNVRT Divide 16 bit dual numbers
FC 85 ADD_32 S5_CNVRT Add 32 bit dual numbers
FC 86 SUB_32 S5_CNVRT Subtract 32 bit dual numbers
FC 87 MUL_32 S5_CNVRT Multiply 32 bit dual numbers
FC 88 DIV_32 S5_CNVRT Divide 32 bit dual numbers
FC 89 RAD_16 S5_CNVRT Extract roots of 16 bit dual numbers
FC 90 REG_SCHB S5_CNVRT Bi-directional shift register, bitwise
FC 91 REG_SCHW S5_CNVRT Bi-directional shift register, wordwise
FC 92 REG_FIFO S5_CNVRT Buffer memory (FIFO)
FC 93 REG_LIFO S5_CNVRT Stack register (LIFO)
FC 94 DB_COPY1 S5_CNVRT Copy data block, direct assignment of parameters
FC 95 DB_COPY2 S5_CNVRT Copy data block, indirect assignment of parameterization
FC 96 RETTEN S5_CNVRT Save scratchpad memory
FC 97 LADEN S5_CNVRT Load scratchpad memory
FC 98 COD_B8 S5_CNVRT Change BCD number to 32 bit dual number
FC 99 COD_32 S5_CNVRT Change 32 bit dual number to BCD number
FC 100 AE_460_1 S5_CNVRT Read analog value
FC 101 AE_460_2 S5_CNVRT Read analog value
FC 102 AE_463_1 S5_CNVRT Read analog value
FC 103 AE_463_2 S5_CNVRT Read analog value
FC 104 AE_464_1 S5_CNVRT Read analog value
FC 105 AE_464_2 S5_CNVRT Read analog value
FC 106 AE_466_1 S5_CNVRT Read analog value
FC 107 AE_466_2 S5_CNVRT Read analog value
FC 108 RLG_AA1 S5_CNVRT Output analog value
FC 109 RLG_AA2 S5_CNVRT Output analog value
FC 110 PER_ET1 S5_CNVRT Read and Write for extended periphery (direct assignment of
parameters)
Siemens S7 S5-S7 Converting Blocks
FC 111 PER_ET2 S5_CNVRT Read and Write for extended periphery (indirect assignment of
parameters)
FC 112 SINUS S5_CNVRT Sine (x)
FC 113 COSINUS S5_CNVRT Cosine (x)
FC 114 TANGENS S5_CNVRT Tangent (x)
FC 115 COTANG S5_CNVRT Cotangent (x)
FC 116 ARCSIN S5_CNVRT Arc sine (x)
FC 117 ARCCOS S5_CNVRT Arc cosine (x)
FC 118 ARCTAN S5_CNVRT Arc tangent (x)
FC 119 ARCCOT S5_CNVRT Arc cotangens (x)
FC 120 LN_X S5_CNVRT Natural logarithm ln (x)
FC 121 LG_X S5_CNVRT Decade logarithm Iog (x)
FC 122 B_LOG_X S5_CNVRT General logarithm Iog (x) to basis b
FC 123 E_H_N S5_CNVRT e to the power of n
FC 124 ZEHN_H_N S5_CNVRT 10 to the power of n
FC 125 A2_H_A1 S5_CNVRT AKKU 2 to the power of AKKU 1
Siemens S7 IEC Blocks
FB 2 IDENTIFY CP_300
FB 3 READ CP_300
FB 4 REPORT CP_300
FB 5 STATUS CP_300
FB 6 WRITE CP_300
FB 8 USEND CP_300
FB 9 URCV CP_300
FB 12 BSEND CP_300
FB 13 BRCV CP_300
FB 14 GET CP_300
FB 15 PUT CP_300
FB 20 GETIO IO_FUNCT
FB 21 SETIO IO_FUNCT
FB 22 GETIO_PART IO_FUNCT
FB 23 SETIO_PART IO_FUNCT
FB 55 IP_CONFIG CP_300
FB 63 TSEND COMM
FB 64 TRCV COMM
FB 65 TCON COMM
FB 66 TDISCON COMM
FB 67 TUSEND COMM
FB 68 TURCV COMM
FC 1 DP_SEND CP_300
FC 2 DP_RECV CP_300
FC 3 DP_DIAG CP_300
FC 4 DP_CTRL CP_300
FC 5 AG_SEND CP_300
FC 6 AG_RECV CP_300
FC 7 AG_LOCK CP_300
FC 8 AG_UNLOCK CP_300
FC 10 AG_CNTRL CP_300
FC 11 PNIO_SEND CP_300
FC 12 PNIO_RECV CP_300
FC 40 FTP_CONNECT CP_300
FC 41 FTP_STORE CP_300
FC 42 FTP_RETRIEVE CP_300
Siemens S7 Communication Blocks
FC 43 FTP_DELETE CP_300
FC 44 FTP_QUIT CP_300
FC 50 AG_LSEND CP_300
FC 60 AG_LRECV CP_300
FC 62 C_CNTRL CP_300
Siemens S7 Communication Blocks
FB 60 SET_SW TIMEFUNC
FB 61 SET_SW_S TIMEFUNC
FB 62 TIMESTMP TIMEFUNC
FC 60 LOC_TIME TIMEFUNC
FC 61 BT_LT TIMEFUNC
FC 62 LT_BT TIMEFUNC
FC 63 S_LTINT TIMEFUNC
Siemens S7 Misc Blocks
The connection type is dependent on the subnet and the transfer protocol via which the connection is established, and on the
automation family to which the connection partners belong.
The blocks (SFBs, FBs, or FCs) you can use depend on the connection type.
The following table should make it easier for you to select the connection type for the connection you want to establish.
* The FCs AG_SEND and AG_RECV here can only be used for S7-300 (this depends on release number of the CP, see the
documentation for the CP).
** The FCs AG_LSEND and AG_LRECV here can generally be used for S7-400, and in addition for S7-300 (this depends on
release number of the CP, see the documentation for the CP).
ol via which the connection is established, and on the
type.
SFB/FB/FC
SFBs USEND, URCV, BSEND, BRCV,
GET, PUT, START, STOP, RESUME,
STATUS, USTATUS
FCs AG_SEND,
AG_RECV,
AG_LSEND,
AG_LRECV
FCs AGSEND,
AGRECEIVE
AG_LSEND,
AG_LRECV,
AG_LOCK,
AG_UNLOCK;
FCs AGSEND,
AGRECEIVE
AG_LSEND,
AG_LRECV,
AG_LOCK,
AG_UNLOCK
FCs AG_SEND*,
AG_RECV*,
AG_LSEND**,
AG_LRECV**
AG_LOCK
AG_UNLOCK
FCs AGSEND,
AGRECEIVE
AG_LSEND,
AG_LRECV
FCs AG-SEND,
AG_LSEND
* PC only as client
** S7-400 as PROFINET IO controller and S7-300 as PROFINET IO device or controller