L9_MBIT: Modify Bit
(Original Document)
Naming
Name in LL984 Editor
Function Block Name
name of legacy 984 instruction
name in other tools and editors like:
  • Type Library Browser
  • Data Editor
  • Animation Tables
  • Search Results
Function Description
The L9_MBIT procedure modifies bit locations within a data matrix - 1 bit location per scan - setting the bit(s) to 1 or clearing the bit(s) to 0.
NOTE: The L9_MBIT procedure will not write to and change the state of any BOOL that has been forced in the Control Expert Animation Table.
The data matrix consists of 16-bit sequences in %M or %MW memory, depending on the respective procedure. The LENGTH value determines the number of 16-bit sequences included in the operation. The SOURCE pin value, combined with the BITLOC pin value, identifies the specific bit location to set to 1 or clear to 0.
The operation begins when the input to the ENABLE pin is turned ON. If the SETBIT pin is turned ON, the value of the scanned bit will be set to 1; if the SETBIT pin is turned OFF, the value of the scanned bit will be set to 0.
If the INCPTR bit is ON - and if the BITLOC pin is tied to a located variable and not a constant - the BITLOC value will increment by 1 upon completion of the current scan.
The OUT output turns ON upon the successful completion of the operation. The SETBITO output echoes the state of the SETBIT value. The ERR output turns ON if the BITLOC value exceeds the size of the data matrix defined by the LENGTH value.
Representation
Parameters
Input Pin
Name
Data Type
Address Range
Meaning
Top
ENABLE
OFF to ON initiates the operation.
Middle
SETBIT
BOOL
OFF = clear bit to 0
ON = set bit to 1
Bottom
INCPTR
BOOL
ON = increment BITLOC by 1 after modification
(only if BITLOC = %MW, not possible if BITLOC = %IW or constant value)
OFF = do not increment BITLOC.
Node
Node Type
Name
Data Type
Address Range
Meaning
Top
IN/OUT
BITLOC
%IW, %MW
Bit location in data matrix to be set or cleared. Can be a constant value, %MW, %IW or an unlocated variable.
Valid range: 1 .. 9,600
Note: Employs LL984 bit addressing: 1-based starting at the left end of 16-bit sequences.
Middle
IN/OUT
DATA
ANY_ARRAY_UINT or ANY_ARRAY_EBOOL
%M, %MW
data matrix with bit to be set/cleared
Bottom
IN
LENGTH
UINT
1...600
length of data matrix (number of 16 bit sequences)
Valid range: 1 to 600.
Output Pin
Name
Data Type
Address Range
Meaning
Top
OUT
BOOL
ON indicates the bit modification operation succeeded. (Echoes the status of the ENABLE input).
Middle
OSETBIT
BOOL
Echoes the value of the SETBIT input.
Bottom
ERR
BOOL
ON = error
bit location > matrix length