Skip the quick fixes that burn the shift
The goal is to clear a block of internal Boolean tags such as C-000001 through on a Productivity3000 (P3000) controller without writing one reset coil per bit. Three quick fixes come up first, and each one costs time.
- Sixteen RST coils in a column. It works, but every added bit means another edit, and it is easy to miss one. It also does not scale past a screen or two.
-
Hunting for a range RST. DirectSOFT5 on the older DirectLOGIC CPUs accepts a start and end address on one coil (
C1toC16withRST). Do not spend time looking for that form in the P3000 software. The P3000 approach is a data-move instruction that writes a list of Boolean tags in one pass. - Converting everything to an array for 16 bits. A 1-D Boolean array with Fill Array works, but it means re-tagging existing logic. It is only worth doing for large blocks, which Check 4 covers.
What restores production fastest is UnpackBits (UPKB) with a constant source of 0. CopyData (CPD) with one source and a list of destinations is the second choice. Get it running with one of these, then clean it up properly.
Check 1: Count the bits and read the tag names
Before you pick an instruction, open the Tag Database and write down two things.
-
How many bits need to change.
UPKBhandles up to 32 Boolean destinations per instruction. -
Whether the tag names are sequential. For example, check whether they run
C-000001, , and so on, with no gaps.
| Reading | What it means | Next check |
|---|---|---|
| 32 bits or fewer | One UPKB covers it |
Check 2 |
| More than 32 bits | You would need several UPKB instructions, and an array starts to pay off |
Check 4 |
| Bits must change together with integer or string tags |
CPD can write mixed data types in one instruction |
Check 4 |
| Sequential tag names | Ctrl-Enter auto-fills the destination list in the instruction dialog | Procedure |
| Scattered tag names | Enter each destination by hand. UPKB and CPD both accept non-contiguous lists. |
Procedure |
UPKB and CPD write only the tags you list. That lets you skip bits, for example resetting every other one, without extra instructions. A DS5-style range reset clears the whole block, so skipping bits there needs several coils.
Check 2: Decide whether every bit goes to the same state
Look at what the logic needs after the reset event.
-
All bits OFF: use a source constant of
0onUPKB. Every listed bit goes to 0. Go to the Procedure. - Some ON, some OFF: you need a pattern word. Go to Check 3.
-
All ON: use a source with every relevant bit set, for example
65535for 16 destinations. Go to the Procedure.
Mechanism you need here: UPKB takes an integer source and copies bit 0 to the first tag in the list, bit 1 to the second, and so on. It writes every listed destination every scan the rung is true. It is not a reset-only instruction. A bit whose source position is 1 gets turned ON.
If other logic SETs any of these C bits, an UPKB on an always-true rung will overwrite them every scan. Drive the rung from a one-shot or an edge contact on the reset condition, not a maintained contact.
Check 3: Build the pattern word for a mixed ON/OFF result
Each position in the UPKB destination list has a binary weight. Position n (counting from 1) has weight 2^(n-1). Add up the weights of the positions you want ON. That sum is your source value.
| List position | Weight | List position | Weight |
|---|---|---|---|
| 1 | 1 | 9 | 256 |
| 2 | 2 | 10 | 512 |
| 3 | 4 | 11 | 1024 |
| 4 | 8 | 12 | 2048 |
| 5 | 16 | 13 | 4096 |
| 6 | 32 | 14 | 8192 |
| 7 | 64 | 15 | 16384 |
| 8 | 128 | 16 | 32768 |
Worked examples, with C-000001 as position 1:
-
First three bits ON, the rest OFF: 1 + 2 + 4 =
7. -
Bits 7, 8, and 9 ON: 64 + 128 + 256 =
448.
Pitfall: writing the pattern as a binary number. Suppose you want "first three ON, last six OFF" and write it as 111000000. Read as binary, that is 448, which turns ON positions 7, 8, and 9. That is the opposite end of the list.
Binary notation puts the least significant bit on the right. UPKB puts the least significant bit in the first list position. For the first three ON, the binary form is 000000111, which is 7.
For a fixed pattern, use a constant source. For a pattern operators or recipes change at runtime, use a 16-bit or 32-bit integer tag as the source. Make that tag retentive if the pattern must survive a power cycle.
Check 4: Pick the instruction for large, scattered, or mixed-type writes
| Situation | Instruction | Why | Watch for |
|---|---|---|---|
| Up to 32 Booleans, any mix of ON/OFF | UPKB |
One source value sets the whole list | Bit order: first list entry = bit 0 |
| Booleans all to one value | CPD |
One source copies to every destination in the list | Check the destination-list limit in the CPD help topic |
| Booleans, integer, and string tags changed on one event | CPD |
One instruction can clear bits, load an error value, and write a message string | Put the Boolean tags first in the list |
| More than 32 bits | 1-D Boolean array + Fill Array | One instruction sizes to the array | Requires re-tagging existing C bits as array elements |
A practical CPD use is a single fault-latch reset. One instruction clears a group of alarm bits, writes a new error code to an integer tag, and loads a string into a message-board tag.
Use one source for many destinations. You do not need a separate source entry per destination. If a list mixes types, keep the Booleans at the top so the conversion from the source value is predictable.
Once the count passes 32, stop stacking UPKB instructions. Define the bits as a 1-D Boolean array and clear the whole array with Fill Array and a value of 0. Only take this route if you can re-tag the existing references during a planned change, not at 3 a.m. with the line down.
Build the UnpackBits reset rung
- Open the task that owns the reset logic and add a rung with your reset condition, for example a reset pushbutton or an HMI reset bit.
- Put a one-shot or edge contact on the condition so the instruction fires once per reset request. It must not rewrite the bits every scan.
- Insert UnpackBits (
UPKB) as the output. - Set the source to constant
0for a full reset. For a pattern, use the value from Check 3 or an integer tag. - Click the first destination field and enter
C-000001. - Press Ctrl-Enter to auto-fill the next sequential tag names down to . The maximum is 32 destinations per instruction.
- Delete any positions you want to leave untouched, or re-point them to other tags. The list does not have to be contiguous.
- Accept the instruction, run a project check, and transfer to the CPU using your site's download procedure.
- Delete the old stack of individual
RSTcoils only after verification passes.
The CPD version follows the same steps. Enter one source (0) and list the C bits as destinations. Add integer or string destinations after the Booleans if the reset should also clear a fault code or message.
Verify the fix before you leave the machine
- Open a Data View with every destination tag and the source tag, if you used one.
- Force or set several of the C bits ON manually.
- Trigger the reset condition once.
- Confirm every listed bit reads 0, or matches your pattern, and that unlisted bits did not change.
- For a pattern word, compare each destination against the weight table. Position 1 must follow the least significant bit.
- Let the machine run a full cycle. Confirm that bits set by process logic after the reset stay set. If they drop back to 0 immediately, the
UPKBrung is not one-shot.
| Symptom after the change | Likely cause | Fix |
|---|---|---|
| Bits will not stay ON after the reset |
UPKB/CPD rung is maintained, not edge-triggered |
Add a one-shot to the rung condition |
| The wrong group of bits turns ON | Pattern entered in binary reading order; bit 0 maps to list position 1 | Recalculate with the weight table (for example, 7 instead of 448) |
| Some bits never change | Missing or mistyped entries in the destination list | Reopen the instruction and check each row, especially after Ctrl-Enter auto-fill |
Integer or string destinations in CPD get odd values |
Mixed-type list order or source type mismatch | Put the Booleans first. Use separate CPD instructions per data type if needed. |
| Unpack String gives inconsistent results | Unproven string-to-bit handling for your content | Switch to UPKB with an integer source |
FAQ
Can I reset C1 through C16 with one RST coil on a Productivity3000 like in DirectSOFT5?
Use UPKB with a constant source of 0 and list C-000001 through as destinations. It clears the block in one instruction, and it can also skip bits you want left alone.
Does UnpackBits turn bits ON as well as OFF?
Yes. UPKB writes the state of each source bit to its listed destination, so a source of 7 turns ON the first three list entries and a source of 448 turns ON entries 7, 8, and 9. Any destination whose source bit is 0 goes OFF.
However, its character-to-bit mapping is not well proven, so test it in a Data View before using it on a running machine. For production logic, useUPKB with an integer source instead. If the bits still misbehave after a clean one-shot UPKB test, stop editing logic and send the project file and CPU firmware details to AutomationDirect technical support.