For 8 bits, with each discrete input bit having a value of 1 or 0, independent of all other input bits, there are 256 (= 2
8) possible patterns.
Or are we misunderstanding the process?
Can we take a step back and describe the process more fully?
For example, there is a reject station where books arrive(?) and are either rejected or not, is that correct?
Since a book can arrive at the reject station, that means the book can be somewhere other than the reject station, so it seems the books must move somehow. There are also cameras "spread along [the] machine," as well as "drops" (positions where pages are added?). How do the books move between these positions? Are they on a conveyor of some sort, as @parky suggests?
TL;DR
All computer programs are a model of something (a process or device) in the real world. A program operates on bits in memory, and those bits in memory represent the state of the process. For example, each book's reject state can be represented by a single bit, with a value of 1 if the book is to be rejected or 0 if not. Before the first page is dropped onto a book and the camera inspects that page, the value of a that book's state is 0, because there is no reason to reject it. Once an any camera detects a problem, the value of the book's bit changes to 0. Only a change from 0 to 1 is possible; subsequent camera inspections that pass cannot make a value of 1 into a 0, and subsequent camera inspections that fail would only overwrite the value of 1 with another value of 1.
An important corollary to this concept of the program as a process model is that the primary design choice is the level of fidelity of the model. The model needs to keep track of the state of each book in the system, and the cycle events of the shaft rotation, and the result of each camera inspection, but it does not need to keep track of
- when or where pages are dropped
- it only needs to inspect the results via the cameras, which cameras are in the model
- operators walking around the plant
- what the operator ate for lunch.
Alternatively, we could keep track of eight individual bits per book so we would know which of the eight drops caused a book to be rejected, however I doubt that is necessary.
Finally, PLC programming is primarily about time, and the PLC scan cycle is the clock. In this process there is another clock, which is the shaft rotation.
So the question is, how does the program deliver (examine) a bit's value of 1 or 0 for that book's reject state when that book is at the reject station? And the answer is in @parky's post: the program has a data model that uses a shift register with a single reject status bit per book. The shifting of the reject status bits'
values along the register bits'
positions represents the cycle that moves all books by some physical linear distance (along the conveyor?). When each shift occurs, a bit with a value of 0 is placed at the head of the shift register. It does not matter if there is actually a book at the start of the conveyor represented by the new bit. What does matter are the positions of the cameras and the reject station. "Station" comes the Latin
stare, to stand, so it is a fixed position: each camera or reject position is at a fixed distance from the start of the conveyor, which start is represented by the first bit in the shift register, where new bit value of 0 written at each cycle. The distances to those stations may be measured in feet or meters, but within the program those linear units are converted to cycle counts. Each cycle represents one revolution of the drive shaft, and one pulse to the PLC input, which represents a fixed linear movement of everything on the conveyor, so converting between the linear measurements of the positions of the stations along the conveyor and the equivalent number of cycles (i.e. shift register bit positions) in the PLC program's data model should be straightforward. The point here is that the location of each camera, and of the reject station, corresponds to the position (index) of a single bit in the shift register. The input from each camera triggers
- EITHER writing a 1 to the value of that single bit to reject the book at that position (model bit),
- OR doing nothing (i.e. leaving the value of that bit as is, either 1 if rejected by a previous camera, or 0 if not)
The value of the bit, at the position in the shift register that corresponds to the physical location of the reject station, triggers
- EITHER activating the reject device output if the value of that bit is 1
- OR doing nothing if the value of that bit is 0
- or perhaps retracting the reject device if that bit's value was 1 on the previous cycle
The assumption of the model is that, when a camera rejects a book, that book is at the camera's station, which station is represented by a single bit's position in the shift register. And the position of a bit must be distinguished from its value:
- the value of a bit represents the reject status of a book at the that bit's corresponding position in the process
- bit values are shifted from one position to the next on each shaft rotation, which represents books (or empty spaces) moving along the conveyor.
Another concept to understand in @parky's data model is that the program keeps track of the spaces between books, with bits that always have a value of 0. It may seem that that information is unnecessary excess fidelity of the model, but actually those space-bits are necessary to maintain the model of the positions of, and the space between, the actual books. So writing a value of 0 to the start position bit of the shift register, when there is no book at that position, places a space into the model representing one cycle's space between books on the conveyor. Since a camera will "see" nothing when a space is in front of it, the corresponding space-bit in the shift register will not change from its value of 0; also, when a space-bit value reaches the reject station's corresponding position, it's value of 0 will not trigger the reject output.