15 sample & hold (l_sh), Sample & hold (l_sh), Function library lenzedrive.lib – Lenze DDS Function library Drive User Manual
Page 36: Analog signal processing

2.2.15
Sample & Hold (L_SH)
Function library LenzeDrive.lib
Analog signal processing
2−26
L
LenzeDrive.lib EN 1.7
2.2.15
Sample & Hold (L_SH)
This FB can store analog signals. The stored value is also available after mains disconnection.
S & H
L _ S H
n I n _ a
b L o a d _ b
n O u t _ a
n C u r V a l R e t a i n
Fig. 2−28
Sample & Hold (L_SH)
VariableName
DataType
SignalType
VariableType
Note
nIn_a
Integer
analog/velocity
VAR_INPUT
bLoad_b
Bool
binary
VAR_INPUT
FALSE = store
nOut_a
Integer
analog/velocity
VAR_OUTPUT
nCurValRetain
Integer
VAR_GLOBAL RETAIN
Function
·
By using bLoad_b = TRUE the signal at nIn_a is switched to nOut_a.
·
By using bLoad_b = FALSE the last valid value is stored and output at nOut_a. A signal change
at nIn_a does not produce any change at nOut_a.
·
Storing in the case of mains disconnection:
– Set bLoad_b = FALSE, when the supply voltage is switched off (either mains/line supply,
DC−bus, or voltage supply of the control terminals).
– Set bLoad_b = FALSE, when the supply voltage is switched on again (either mains/line
supply, DC−bus, or voltage supply of the control terminals).
Store the present output value after power interruption
[ V A R _ G L O B A L R E T A I N ]
[ V A R _ G L O B A L R E T A I N ]
S & H
L _ S H
n I n _ a
b L o a d _ b
n O u t _ a
n C u r V a l R e t a i n
Fig. 2−29
Programming to store the present output value after a supply interruption
Inorder to store the latest value at nOut_a after a supply interruption, you must declare a global
variable of type RETAIN (VAR_GLOBAL RETAIN). Link this variable as shown in Fig. 2−29.
·
In this variable, the present value is always stored at nOut_a The variable will hold the value
after a supply interruption.
·
When the supply is switched on again, the stored value is read into the FB L_SH from the
variable and applied as the starting value.