FB_Ramp
Function block for realizing a light-ramp.
A rising edge at input bOn switches the light to the maximum value (32767). A rising edge at input bOff switches the light off again. Rising edges at the bToggle input invert the respective light state. A positive edge at the bStart input allows the function block to dim the light from the current level to nEndLevel. The time required for this is defined by tRampTime. All inputs are only active as long as bEnable is TRUE, otherwise the function block is reset internally.
VAR_INPUT
bEnable : BOOL;
bOn : BOOL;
bOff : BOOL;
bToggle : BOOL;
bStart : BOOL;
nEndLevel : BYTE;
tRampTime : TIME := t#10s;
nOptions : DWORD;
bEnable: The bOn, bOff, bToggle and bStart inputs are active as long as this input is TRUE. A negative state deactivates the inputs and resets the function block.
bOn: A rising edge directly switches nLightLevel to the maximum value (32767).
bOff: A rising edge directly switches nLightLevel to "0".
bToggle: Switches the light state between On (32767) and Off (0).
bStart: If a rising edge is applied to this input, the light is dimmed up or down from the current value to nEndLevel. The time required for this is defined by tRampTime. The dimming procedure can be interrupted at any time by bOn, bOff or bToggle.
nEndLevel: Target value of the dimming procedure.
tRampTime: Ramp time, see bStart. (Preset value: 10 seconds).
nOptions: Reserved for future developments.
VAR_OUTPUT
bLight : BOOL;
bBusy : BOOL;
bError : BOOL;
nErrorId : UDINT;
bLight: This output is set as long as nLightLevel is greater than 0.
bBusy: This output is always active as long as the processing of a command (bOn, bOff, bToggle or ramp) is active.
bError: This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in nErrorId. Is reset to FALSE by the execution of a command at the inputs.
nErrorId: Contains the command-specific error code of the most recently executed command. Is reset to "0" by the execution of a command at the inputs. See Error codes.
VAR_IN_OUT
nLightLevel : UINT;
nLightLevel: Output control value of the function block and reference to the light output value. This value is defined as In-Out variable because the function block reads and writes the light value.
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4020.32 | Tc2_BABasic from v3.1.0.0 |