Baixe Relação Blocos Codesys e outras Manuais, Projetos, Pesquisas em PDF para Programação em Windows, somente na Docsity!
Standard function blocks
What this chapter contains
This chapter describes the standard function blocks. The blocks are grouped
according to the grouping in the DriveSPC tool. It depends about drive type which
amount of blocks and what kind of blocks are available.
The number in brackets in the standard block heading is the block number.
Note: The given execution times can vary depending on the used drive application.
Terms
Data type Description Range
Boolean Boolean 0 or 1
DINT 32-bit integer value (31 bits + sign) -2147483648…
INT 16-bit integer value (15 bits + sign) -32768…
PB Packed Boolean 0 or 1 for each individual bit
REAL -32768,99998…32767,
REAL24 -128,0…127,
- Standard function blocks .....................................................................................................................
- What this chapter contains ..............................................................................................................
- Terms...............................................................................................................................................
- Arithmetic .........................................................................................................................................
- ABS..................................................................................................................................................
- ADD .................................................................................................................................................
- DIV...................................................................................................................................................
- EXPT ...............................................................................................................................................
- MOVE ..............................................................................................................................................
- MUL ...............................................................................................................................................
- SQRT.............................................................................................................................................
- SUB ...............................................................................................................................................
- Bitstring..........................................................................................................................................
- AND ...............................................................................................................................................
- NOT ...............................................................................................................................................
- OR .................................................................................................................................................
- ROL ...............................................................................................................................................
- ROR...............................................................................................................................................
- SHL................................................................................................................................................
- SHR ...............................................................................................................................................
- XOR ...............................................................................................................................................
- Bitwise ...........................................................................................................................................
- BGET .............................................................................................................................................
- BITOR............................................................................................................................................
- BSET .............................................................................................................................................
- REG ...............................................................................................................................................
- SR-D ..............................................................................................................................................
- Communication..............................................................................................................................
- D2D_Conf ......................................................................................................................................
- D2D_McastToken ..........................................................................................................................
- D2D_SendMessage.......................................................................................................................
- DS_ReadLocal...............................................................................................................................
- DS_WriteLocal...............................................................................................................................
- Comparison ...................................................................................................................................
- EQ..................................................................................................................................................
- GT..................................................................................................................................................
- LE ..................................................................................................................................................
- LT...................................................................................................................................................
- NE..................................................................................................................................................
- Conversion.....................................................................................................................................
- BOOL_TO_DINT ...........................................................................................................................
- BOOL_TO_INT ..............................................................................................................................
- DINT_TO_BOOL ...........................................................................................................................
- DINT_TO_INT................................................................................................................................
- DINT_TO_REALn ..........................................................................................................................
- DINT_TO_REALn_SIMP ...............................................................................................................
- INT_TO_BOOL ..............................................................................................................................
- INT_TO_DINT................................................................................................................................
- REAL_TO_REAL24 .......................................................................................................................
- REAL24_TO_REAL .......................................................................................................................
- REALn_TO_DINT ..........................................................................................................................
- REALn_TO_DINT_SIMP ...............................................................................................................
- Counters ........................................................................................................................................
- CTD ...............................................................................................................................................
- CTD_DINT .....................................................................................................................................
- CTU ...............................................................................................................................................
- CTU_DINT .....................................................................................................................................
- CTUD.............................................................................................................................................
- CTUD_DINT ..................................................................................................................................
- Edge & bistable..............................................................................................................................
- FTRIG ............................................................................................................................................
- RS..................................................................................................................................................
- RTRIG............................................................................................................................................
- SR..................................................................................................................................................
- Extensions .....................................................................................................................................
- FIO_01_slot1 .................................................................................................................................
- FIO_01_slot2 .................................................................................................................................
- FIO_11_AI_slot1............................................................................................................................
- FIO_11_AI_slot2............................................................................................................................
- FIO_11_AO_slot1 ..........................................................................................................................
- FIO_11_DIO_slot1.........................................................................................................................
- FIO_11_DIO_slot2.........................................................................................................................
- Feedback & algorithms ..................................................................................................................
- CRITSPEED ..................................................................................................................................
- CYCLET.........................................................................................................................................
- DATA CONTAINER .......................................................................................................................
- FUNG-1V .......................................................................................................................................
- INT .................................................................................................................................................
- MOTPOT .......................................................................................................................................
- PID.................................................................................................................................................
- RAMP ............................................................................................................................................
- REG-G ...........................................................................................................................................
- SOLUTION_FAULT .......................................................................................................................
- Filters .............................................................................................................................................
- FILT1 .............................................................................................................................................
- FILT2 .............................................................................................................................................
- LEAD/LAG .....................................................................................................................................
- Parameters ....................................................................................................................................
- GetBitPtr ........................................................................................................................................
- GetValPtr .......................................................................................................................................
- PARRD ..........................................................................................................................................
- PARRDINTR..................................................................................................................................
- PARRDPTR ...................................................................................................................................
- PARWR .......................................................................................................................................
- Selection ......................................................................................................................................
- LIMIT............................................................................................................................................
- MAX .............................................................................................................................................
- MIN ..............................................................................................................................................
- MUX.............................................................................................................................................
- SEL ..............................................................................................................................................
- Switch & Demux ..........................................................................................................................
- DEMUX-I......................................................................................................................................
- DEMUX-MI...................................................................................................................................
- SWITCH.......................................................................................................................................
- SWITCHC ....................................................................................................................................
- Timers..........................................................................................................................................
- MONO..........................................................................................................................................
- TOF..............................................................................................................................................
- TON .............................................................................................................................................
- TP ................................................................................................................................................
Operation The output (OUT) is the sum of the inputs (IN1…IN32). OUT = IN1 + IN2 + … + IN The output value is limited to the maximum and minimum values defined by the selected data type range.
Inputs The input data type and the number of the inputs (2…32) are selected by the user. Input (IN1…IN32): DINT, INT, REAL or REAL
Outputs Output (OUT): DINT, INT, REAL or REAL
DIV
(10002)
Illustration
Execution time
2.55 μs
Operation The output (OUT) is input IN1 divided by input IN2. OUT = IN1/IN The output value is limited to the maximum and minimum values defined by the selected data type range. If the divider (IN2) is 0, the output is 0.
Inputs The input data type is selected by the user. Input (IN1, IN2): INT, DINT, REAL, REAL
Outputs Output (OUT): INT, DINT, REAL, REAL
EXPT
(10003)
Illustration
Execution time
81.90 μs
Operation The output (OUT) is input IN1 raised to the power of the input IN2: OUT = IN1IN If input IN1 is 0, the output is 0. The output value is limited to the maximum value defined by the selected data type range. Note: The execution of the EXPT function is slow.
Inputs The input data type is selected by the user. Input (IN1): REAL, REAL Input (IN2): REAL
Outputs Output (OUT): REAL, REAL
MOD
(10004)
Illustration
MUL
(10006)
Illustration
Execution time
3.47 μs (when two inputs are used) + 2.28 μs (for every additional input). When all inputs are used, the execution time is 71.73 μs.
Operation (^) The output (OUT) is the product of the inputs (IN). O = IN1 × IN2 × … × IN The output value is limited to the maximum and minimum values defined by the selected data type range.
Inputs (^) The input data type and the number of inputs (2…32) are selected by the user. Input (IN1…IN32): INT, DINT, REAL, REAL
Outputs (^) Output (OUT): INT, DINT, REAL, REAL
MULDIV
(10007)
Illustration
Execution time
7.10 μs
Operation The output (O) is the product of input IN and input MUL divided by input DIV. Output = (I × MUL) / DIV O = whole value. REM = remainder value. Example: I = 2, MUL = 16 and DIV = 10: (2 × 16) / 10 = 3.2, i.e. O = 3 and REM = 2 The output value is limited to the maximum and minimum values defined by the data type range.
Inputs Input (I): DINT Multiplier input (MUL): DINT Divider input (DIV): DINT
Outputs Output (O): DINT Remainder output (REM): DINT
SQRT
(10008)
Illustration
Execution time
2.09 μs
Operation Output (OUT) is the square root of the input (IN). OUT = sqrt(IN) Output is 0 if the input value is negative.
Inputs The input data type is selected by the user. Input (IN): REAL, REAL
Outputs Output (OUT): REAL, REAL
Bitstring
AND
(10010)
Illustration
Execution time
1.55 μs (when two inputs are used) + 0.60 μs (for every additional input). When all inputs are used, the execution time is 19.55 μs.
Operation The output (OUT) is 1 if all the connected inputs (IN1…IN32) are 1. Otherwise the output is 0. Truth table:
The inputs can be inverted.
Inputs The number of inputs is selected by the user. Input (IN1…IN32): Boolean
Outputs Output (OUT): Boolean
NOT
(10011)
Illustration
Execution time
0.32 μs
Operation The output (O) is 1 if the input (I) is 0. The output is 0 if the input is 1.
Inputs (^) Input (I): Boolean
Outputs (^) Output (O): Boolean
OR
(10012)
Illustration
Execution time
1.55 μs (when two inputs are used) + 0.60 μs (for every additional input). When all inputs are used, the execution time is 19.55 μs.
Inputs The input data type is selected by the user. Number of bits input (BITCNT): INT, DINT Input (I): INT, DINT
Outputs Output (O): INT, DINT
ROR
(10014)
Illustration
Execution time
1.28 μs
Operation Input bits (I) are rotated to the right by the number (N) of bits defined by BITCNT. The N least significant bits (LSB) of the input are stored as the N most significant bits (MSB) of the output. Example: If BITCNT = 3
Inputs The input data type is selected by the user. Number of bits input (BITCNT): INT, DINT Input (I): INT, DINT
Outputs Output (O): INT, DINT
SHL
(10015)
Illustration
Execution time
0.80 μs
Operation Input bits (I) are rotated to the left by the number (N) of bits defined by BITCNT. The N most significant bits (MSB) of the input are lost and the N least significant bits (LSB) of the output are set to 0. Example: If BITCNT = 3
Inputs The input data type is selected by the user. Number of bits (BITCNT): INT; DINT Input (I): INT, DINT
Outputs Output (O): INT; DINT
XOR
(10017)
Illustration
Execution time
1.24 μs (when two inputs are used) + 0.72 μs (for every additional input). When all inputs are used, the execution time is 22.85 μs.
Operation The output (OUT) is 1 if one of the connected inputs (IN1…IN32) is 1. Output is zero if all the inputs have the same value. Example:
The inputs can be inverted.
Inputs The number of inputs (2…32) is selected by the user. Input (IN1…IN32): Boolean
Outputs Output (OUT): Boolean
Bitwise
BGET
(10034)
Illustration
Execution time
0.88 μs
Operation The output (O) is the value of the selected bit (BITNR) of the input (I). BITNR: Bit number (0 = bit number 0, 31 = bit number 31) If bit number is not in the range of 0…31 (for DINT) or 0…15 (for INT), the output is 0.
Inputs The input data type is selected by the user. Number of the bit (BITNR): DINT Input (I): DINT, INT
Outputs Output (O): Boolean
BITAND
(10035)
Illustration
Execution time
0.32 μs