Productivity 2000 PLC Array Functions Part 3

An array is a storage area for common data type tags. They usually have some relationship with each other and must be manipulated as a group. We can use arrays for motion control, recipe management, sequencing (indirect addressing), math, etc. The Productivity 2000 Series PLC uses arrays programmed using the Productivity Suite Software.
Productivity 2000 PLC Array Functions Part 1
Previously we defined an array and used this in an indirect addressing program. It sequenced bits in an output card indirectly. We then looked at the following instructions: Array Statistics (STA), Copy Array (CPA), Fill Array (FLA), and Shift / Rotate Array (SRA). We will now look at the final four array instructions:
Pack Boolean Array (PBA) – Pack an Array of Boolean tags into a destination Word Array
Pack Word Array (PWA) – Convert one 8-bit or 16-bit Array into a 16 or 32-bit Destination Array tag.
UnPack Boolean Array (UPBA) – Unpack an Array of Word tags into a destination Boolean Array.
UnPack Word Array (UPWA) – Convert one 32 or 16-bit array source tag into four eight or 16-bit array tags.
Let’s start with our final look at our Productivity 2000 Series PLC arrays.

Previously in this Productivity 2000 series PLC, we have discussed the following:
P2000 Hardware FeaturesVideo
Productivity Suite Software InstallVideo
Communication (System Configuration)Video
First ProgramVideo
Debug ModeVideo
PLC Program DocumentationVideo
PLC CPU DisplayVideo
PLC Online ProgrammingVideo
PLC Tag DatabaseVideo
Ladder Logic ContactsVideo
Ladder Logic OutputsVideo
TimersVideo
CounterVideo
Productivity 2000 PLC Ladder Logic MathVideo
Data Handling Instructions
Part 1Video
Part 2Video
Array Functions
Part 1Video
Part 2Video

Creating our Productivity Database Arrays

The following instructions demonstrate the ability to manipulate the arrays from one form to another.
We will start by creating three different arrays. This is done with the Tag Database that we have discussed previously.
Boolean Array
Name: Boolean_Array – Boolean, 1D Array – Columns 64
We can then populate some information in the Array by selecting some bits to be on for the initial state.
Word 8 Bit Array
Name: Word_8Bit – Integer, 8 Bit Unsigned, 1D Array – Columns 10
Word 16 Bit Array
Name: Word_16Bit – Integer, 16 Bit Unsigned, 1D Array – Columns 5

Pack Boolean Array (PBA)

This instruction will Pack an Array of Boolean tags into a destination Word Array.
Productivity 2000 PLC Array Functions Part 3

The above example shows 16 bits being packed into two 8-bit arrays.

Productivity 2000 PLC Array Functions Part 3
We will use the structure with this instruction. (Pack_Bit_Array) If we did not use structure, then you will need to specify all of the parameters for the instruction.
P2000 Ladder Logic Program
We will use Boolean_Array for our source and Word_8Bit for our destination array.
The structure tags will define how the instruction will work. Our source starts, and end columns will be 1 to 32. The destination start column will be 1. Remember that the array instruction will always start at 1 for the first element.
Hit OK
P2000 Ladder Logic Program
When Switch 6 is on, the first 32 bits of the Boolean Array will be moved into the Word 8-bit Array. This will then populate the first four words. (8 bits x 4 words = 32 bits)

Pack Word Array (PWA)

This instruction will Convert one 8-bit or 16-bit array into a 16 or 32-bit Destination Array tag.
Productivity 2000 PLC Array Functions Part 3
The above example shows eight 8-bit words packed into two 32-bit words.
Productivity 2000 PLC Array Functions Part 3
We will use the structure named Pack_Word_Array.
P2000 Ladder Logic Program
Our example will move 8-bit words to 16-bit words. The source array will be our Word_8Bit, and the destination will be Word_16Bit Array. Hit OK.
The tags of the instruction will be defined as follows:
Source Start Column = 1
Source End Column = 4
Destination Start Column = 1
P2000 Ladder Logic Program
Switch seven will activate the pack word instruction. It will move the first four 8-bit words from the source array to the first two 16-bit works in the destination array.

UnPack Boolean Array (UPBA)

This instruction will Unpack an Array of Word tags into a destination Boolean Array.
Productivity 2000 PLC Array Functions Part 3
The above example takes two 8-bit words and moves them into 16 bits of the Boolean destination array.
Productivity 2000 PLC Array Functions Part 3
We will use a structure named UnPack_Boolean.
P2000 Ladder Logic Program
The source array will be Word_8Bit, and the Boolean_Array will be our destination.
The source start column will be one, and the end column will be 2. The destination start column will be 16.
P2000 Ladder Logic Program
When switch 8 is on, the UnPack Boolean Array instruction runs and will take the first two 8-bit words and move them to the Boolean destination array starting at bit 16.

UnPack Word Array (UPWA)

This instruction will Convert one 32 or 16-bit array source tag into four eight or 16-bit Array tags.
Productivity 2000 PLC Array Functions Part 3
The above example moves two 32-bit array words to eight 8-bit array words. We specify the start and end columns in the source array and the start column in the destination array.
Productivity 2000 PLC Array Functions Part 3
We will name the structure UnPack_Word.
P2000 Ladder Logic Program
Select the Word (16-bit) to Byte (8-bit). Our source array is Word_16Bit, and the destination array is Word_8Bit. Hit OK.
Our source start and end initial values will be 1 and 2. The destination initial value will be 3.
P2000 Ladder Logic Program
When Switch 1 is energized, the first two 16-bit words in the source array will be placed into four 8-bit words (Byte) in the destination. The destination will be the third location.

Download the PLC program here.

Watch the video below for the array instructions we created on our Productivity 2000 Series PLC.

Productivity 2000 Series PLC from Automation Direct
Overview Link (Additional Information on the Unit)
Configuration (Configure and purchase a system – BOM)
User Manual and Inserts (Installation and Setup Guides)
Productivity Suite Overview (Features of the fully functional free software package for the Productivity Family of PLC (PAC) controllers)
Productivity Suite Programming Software (Free Download Link)
This software contains all the instructions and helps files for the Productivity Series.

Watch on YouTube: Productivity 2000 PLC Array Functions Part 3

If you have any questions or need further information, please get in touch with me.
Thank you,
Garry


If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, decimals, Hexadecimal, ASCII, and Floating points.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available for free download. The link is included when you subscribe to ACC Automation.

Leave a Comment