FB_Ramp

FB_Ramp 1:
FB_Ramp

Function-block creating a light-ramp.

With a rising-edge at bOn the light will be switched immediately to the maximum-level (32767) and a rising edge at bOff turns the light off. Triggering the input bToggle inverts the actual light-state. A rising-edge at bStart starts dimming the light from the actual to the end-level (nEndLevel) - the required time is defined by tRampTime. As long as bEnable is TRUE all inputs are active, otherwise the controlling inputs bOn, bOff, bToggle and bStart are deactivated and the function-block turns to its idle-mode.

VAR_INPUT

bEnable         : BOOL;
bOn             : BOOL;
bOff            : BOOL;
bToggle         : BOOL;
bStart          : BOOL;
nEndLevel       : BYTE;
tRampTime       : TIME := t#10s;
nOptions        : DWORD;

bEnable: A positive input enables the function block. A negative state deactivates the inputs and sets the function-block to the idle-mode.

bOn: A rising edge sets the output nLightLevel directly to the maximum-level (32767).

bOff: A rising edge sets the output nLightLevel immediately to "0".

bToggle: Rising edges at this input toggle the nLightLevel between "0" and "32767".

bStart:This input starts the dim-ramp from the actual value to nEndLevel within the time defined as tRampTime. This can be interrupted by bOn, bOff or bToggle at any time.

nEndLevel: Target-value of the dim-ramp.

tRampTime: Ramp-time, see bStart. (Initial value: 10s).

nOptions: Reserved for future developments.

VAR_OUTPUT

bLight              : BOOL;
bBusy               : BOOL;
bError              : BOOL;
nErrorId            : UDINT;

bLight: As long as nLightLevel is greater than "0", this output is set to TRUE.

bBusy: When the block is activated the output is set, and it remains active until execution of the command has been completed.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in nErrorId. bError is reset to FALSE by the execution of an instruction at the inputs.

nErrorId: Contains the command-specific error code of the most recently executed command. nErrorId is reset to 0 by the execution of an instruction at the inputs. See Error codes.

VAR_IN_OUT

nLightLevel         : UINT;

nLightLevel: Reference to the actual light-level-output. This output has to be an IN-OUT-Variable because the function-block may need the actual level as a start-level for a ramp.