"Boolean ON/OFF" instruction
Instruction used in the part-program for "Set" or "Reset" (set to "1" or "0") a variable of type BOOL.
Figure 1: ON/OFF Boolean programming window
Below is a list of the instruction's input and output parameters:
Parameter name |
Declaration |
Type of data |
Default value |
Description |
---|---|---|---|---|
Variable |
Input |
BOOL |
-- |
Variable set to "1" or "0". |
ON/OFF |
Input |
-- |
OFF |
Setpoint for changing the status of the variable |
Delay [ms] |
Input |
TIME |
0[ms] |
Time before changing the state of the variable |
Table 1: List of instruction parameters
The basic function of the instruction is to set a BOOL variable to "1" or "0" for an indefinite period of time. But you can also define a time during which the variable must remain at "1" or "0", at the end of this time, the variable will take the opposite state.
The time set in parameter is always rounded up or down to a multiple of 50[ms], depending on whether the value set in parameter is respectively greater than "n X 50[ms] + 25[ms]" or smaller than "n X 50[ms] + 25[ms]".
Example:
If |
set time = 120[ms] |
=> |
real time = 100[ms] |
If |
set time = 135[ms] |
=> |
real time = 150[ms] |
The set time can be given by a constant or user variable in "TIME" format.
Figure 2: Programmation d'un temps avant la retombée du bit
In the example in figure 2, the time that will elapse before the variable "VarBool_num6" set to "0" will actually be 100[ms], not 86[ms] as set.
Tip: If you want to reverse the state of a Boolean variable after a time, simply select in the instruction the state that the variable will have before the instruction is executed and add a time in the delay parameter. The variable will then keep its current state until the time delay has elapsed, then it will take the opposite state. Example: We want to set the value of a Boolean to "1" after 100[ms].
|