4-24 Series 90-30/20/Micro Programmable Controllers Reference Manual September 1998 GFK-0467K

4
Example:
In the following example, the PLC is used to keep track of the number of parts contained in atemporary storage area. There are two ways of accomplishing this function using the Series 90-30/20/Micro instruction set.The first method is to use an up/down counter pair with a shared register for the accumulated orcurrent value. When the parts enter the storage area, the up counter increments by 1, increasing thecurrent value of the parts in storage by a value of 1. When a part leaves the storage area, the downcounter decrements by 1, decreasing the inventory storage value by 1. To avoid conflict with theshared register, both counters use different register addresses. When a register counts, its currentvalue must be moved to the current value register of the other counter.
|
| _____
|%I0003 | |
|——| |——+————————————————>UPCTR|
| | | |
|%I0001 | | |
+——| |——+ +————————+R |
| | | |
|%I0009 | | |
+——| |——————————+ CONST -+PV |
| +00005 | |
| +_____+
|
| %R0100
|
| _____
|%I0003 | |
|——| |——+—————————+MOVE_+
| | |INT |
|%I0001 | | |
+——| |——+ %R0100 -+IN Q|–%R0104
| | LEN |
| |00001|
| |_____|
|
| _____
|%I0003 | |
|——| |——+————————————————>DNCTR|
| | | |
|%I0002 | | |
+——| |——+ +————————+R |
| | | |
|%I0009 | | |
+——| |——————————+ CONST -+PV |
| +00005 | |
| +_____+
|
| %R0104
|
| _____
|%I0002 | |
|——| |——+—————————+MOVE_+
| | |INT |
|%I0003 | | |
+——| |——+ %R0104 -+IN Q|-%R0100
| | LEN |
| |00001|
| |_____|
|