On bigger machines, I/O points can become occupied very quickly. The example of I/O-based subroutine select is fine where only 4 different parts are concerned, but what if the machine was used to run 16 parts, or even 32? This is where the IN and INB commands come in.
In the diagram above, inputs 14, 15, 16, 17 and 18 are being used to read a part number from a PLC. This first example demonstrates the IN command which stands for "Binary Read IN". Whatever combination is seen on the inputs at the time of the IN command is placed into variable 99 in decimal format. In this case, "30" is placed into variable 99. As with the "I/O Subroutine Select" example to the left, this "30" could be interpreted as meaning "execute subroutine 30". The IN command works for a maximum of 31 consecutive input points, effectively giving the user 2,147,480,000 different logic states to work with! Example:
IN 14 18 /Binary read through inputs 14-18
The INB command stands for "BCD Read IN" and works on Binary Coded Decimal instead of just plain binary. The first 4 bits are the "ones", the second 4 bits are the "tens", the next 4 are the "hundreds" and so on. The maximum number of 4-bit groups is 8, which would require the user to havea consecutive group of 32 inputs. This limits the user to a mere 99,999,999 different logic states. The INB command also stores the decimal result in variable 99.
INB 14 18 /BCD read w/ 14-17 as "ones", 18 as ten
What's the advantage of using INB versus IN? If the system the user is working on has a device that sends out BCD, INB would probably be best. INB is also easier to decipher when dealing with larger groups of 1's and 0's. The code example shows the selection of subroutines based on the results of an INB command