Batch counter
Each part passing the sensor adds 1. At the preset the batch is full. A button resets the count for the next batch.
Step by step
Pick a step. The rungs are drawn by the editor after Core scans the program up to that step.
Global.PartEyeXIC
Global.BatchCTU
PRE 3 ACC 1 CU 1 CD 0 DN 0 OV 0 UN 0
Global.Batch.DNXIC
Global.BatchFullOTE
Global.NextBatchPBXIC
Global.BatchRES
1. Part 1. The CTU rung turns on, so ACC goes to 1.
Global.PartEyeXIC
Global.BatchCTU
PRE 3 ACC 1 CU 0 CD 0 DN 0 OV 0 UN 0
Global.Batch.DNXIC
Global.BatchFullOTE
Global.NextBatchPBXIC
Global.BatchRES
2. Gap. The rung turns off. Nothing is counted.
Global.PartEyeXIC
Global.BatchCTU
PRE 3 ACC 2 CU 1 CD 0 DN 0 OV 0 UN 0
Global.Batch.DNXIC
Global.BatchFullOTE
Global.NextBatchPBXIC
Global.BatchRES
3. Part 2. A new rising edge. ACC goes to 2.
Global.PartEyeXIC
Global.BatchCTU
PRE 3 ACC 2 CU 0 CD 0 DN 0 OV 0 UN 0
Global.Batch.DNXIC
Global.BatchFullOTE
Global.NextBatchPBXIC
Global.BatchRES
4. Gap. ACC stays at 2.
Global.PartEyeXIC
Global.BatchCTU
PRE 3 ACC 3 CU 1 CD 0 DN 1 OV 0 UN 0
Global.Batch.DNXIC
Global.BatchFullOTE
Global.NextBatchPBXIC
Global.BatchRES
5. Part 3. ACC reaches PRE, 3. DN turns on and so does BatchFull.
Global.PartEyeXIC
Global.BatchCTU
PRE 3 ACC 0 CU 0 CD 0 DN 0 OV 0 UN 0
Global.Batch.DNXIC
Global.BatchFullOTE
Global.NextBatchPBXIC
Global.BatchRES
6. Press NextBatchPB. RES clears ACC and DN. BatchFull is still 1, because its rung ran above the RES in this scan.
Global.PartEyeXIC
Global.BatchCTU
PRE 3 ACC 0 CU 0 CD 0 DN 0 OV 0 UN 0
Global.Batch.DNXIC
Global.BatchFullOTE
Global.NextBatchPBXIC
Global.BatchRES
7. Release NextBatchPB. Rung 1 now reads DN as 0, so BatchFull turns off.
| Step | PartEye | Batch.ACC | Batch.DN | BatchFull |
|---|---|---|---|---|
| 1. Part 1 | 1 | 1 | 0 | 0 |
| 2. Gap | 0 | 1 | 0 | 0 |
| 3. Part 2 | 1 | 2 | 0 | 0 |
| 4. Gap | 0 | 2 | 0 | 0 |
| 5. Part 3 | 1 | 3 | 1 | 1 |
| 6. Press NextBatchPB | 0 | 0 | 0 | 1 |
| 7. Release NextBatchPB | 0 | 0 | 0 | 0 |
Why it works
- A CTU adds 1 to ACC each time its rung turns on. A part that stays in front of the sensor counts once.
- DN turns on when ACC reaches PRE.
- RES sets ACC back to 0 and clears DN. PRE is kept.
Common mistakes
- Resetting with a MOV of 0 into ACCRES clears DN as well as ACC. Use RES on the counter tag.
- Holding the reset buttonWhile RES is true the counter stays at 0, so parts that pass during the reset are lost.