4-64 Series 90-30/20/Micro Programmable Controllers Reference Manual September 1998 GFK-0467K
4
BPOS (WORD)
The Bit Position (BPOS) function is used to locate a bit set to 1 in a bit string.
Each sweep that power is received, the function scans the bit string starting at IN. When the
function stops scanning, either a bit equal to 1 has been found or the entire length of the string has
been scanned.
POS is set to the position within the bit string of the first non-zero bit; POS is set to zero if no non-
zero bit is found.
A string length of 1 to 256 words can be selected. The function passes power flow to the right
whenever enable is ON.
_____
| |
(enable) —| BIT_|— (ok)
| POS |
| WORD|
| |
| |
(first word) —|IN |
| |
| LEN |
|00001|
| POS|— (position of non-zero bit or 0)
|_____|
Parameters:
Parameter Description
enable When the function is enabled, a bit search operation is performed.
IN IN contains the first word of the data to be operated on.
ok The ok output is energized whenever enable is energized.
POS The position of the first non-zero bit found, or zero if a non-zero bit is not found.
LEN LEN is the number of words in the bit string.
Note
When using the Bit Test, Bit Set, Bit Clear or Bit Position function, the bits
are numbered 1 through 16, NOT 0 through 15.