Count down CTD
Takes 1 away each time the rung turns on.
Global.StockCTD
PRE 0 ACC 9 CU 0 CD 1 DN 1 OV 0 UN 0
| Tag | After two scans |
|---|---|
| Stock | PRE 0 ACC 9 CU 0 CD 1 DN 1 OV 0 UN 0 |
How it works
Subtracts 1 from ACC on each false-to-true rung change; holding the rung true does not count again. DN is 1 while ACC is at or above PRE.
How it's used
Use CTD to count down what is left, such as parts in a feeder.
Global.PickEyeXIC
Global.StockCTD
PRE 2 ACC 1 CU 0 CD 1 DN 0 OV 0 UN 0
Global.Stock.DNXIO
Global.ReorderOTE
| Tag | Value |
|---|---|
| PickEye | 1 |
| Stock | PRE 2 ACC 1 CU 0 CD 1 DN 0 OV 0 UN 0 |
| Reorder | 1 |
Two picks took Stock from 3 to 1. ACC is below PRE, so Reorder is on.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| Counter | COUNTER | Reads and writes |
Inside a COUNTER tag
| Member | Type | Meaning |
|---|---|---|
| .PRE | DINT | You can write it |
| .ACC | DINT | Read only |
| .CU | BOOL | Read only |
| .CD | BOOL | Read only |
| .DN | BOOL | Read only |
| .OV | BOOL | Read only |
| .UN | BOOL | Read only |
Common mistakes
- Expecting DN when the count runs outDN is on while ACC is at or above PRE. It turns off when the count drops below PRE.
Learn it in a lesson
- Counting eventsIntermediate · 25 min