An array is a storage area for a group of common data type tags. They usually have some relationship to each other and need to be manipulated as a group. We can use arrays for motion control, recipe management, sequencing (indirect addressing), math, etc. The Productivity 1000 Series PLC uses arrays which are programmed using the Productivity Suite Software.
We will be defining an array and use this in an indirect addressing program. This will sequence bits in an output card indirectly.
Let’s get started with the Productivity 1000 Series PLC arrays.
Previously in this Productivity 1000 series PLC we have discussed:
System Hardware – Video
Installing the Software – Video
Establishing Communication – Video
First Program – Video
Documenting the Program – Video
Monitoring and Testing the Program – Video
Online Editing and Debug Mode – Video
Numbering Systems and Tag Database – Video
Contact and Coil Instructions – Video
Timer Instructions – Video
Counter Instructions – Video
Math Instructions – Video
Data Handling Instructions Part 1 – Video
Data Handling Instructions Part 2 – Video
What are Arrays?
Arrays are like excel spreadsheets.
The excel spreadsheet is made up of columns and rows. Individual cells are addressed by the coordinates of columns and rows. In our example the highlighted cell is C3. The information that is in the cell can be any variable type that we want.
Addressing Arrays in the Productivity Series PLC
Individual elements (values in the array) are addressed by their index. (Coordinates (Row, Column)) The address of the above element in the array called Widget Progress is Widget Progress (4), (2).
Format: Array Name (Row), (Column)
Note: Row and Column index always begin at 1.
The above array example was a 2 dimensional array. (2D – X and Y) The productivity series PLC can also have a 1 dimensional array. (1D – X)
Since we have only one row in this array, we would address the element by the column location. In our example Widget Progress (2) would be the location of the element highlighted.
Format: Array Name (Column)
Indirect addressing (pointers) in the Productivity Series PLC
We use arrays to handle indirect addressing in the productivity series PLC. A tag name can be specified as the index of the array.
Widget Progress (Pointer) – 1D array
Widget Progress (Pointer_Row), (Pointer_Column)
Creating an Array
Call up the tag database. Main menu | Edit | Tag Database. You can also get to this under the Application Tools menu located under the Write Program folder.
Select the Add Tags button at the bottom of the Tag Database window.
We can now assigned the following:
Tag Name: Sequence
Data Type: 1D Array
Integer, 16 Bit Unsigned, 1D Array
Hit Add to make the tag in our database. Select close to stop adding to our tag database.
Select Integers to view the integers in our program. You will now see the array Sequence in the list. Sequence (1) to Sequence (30) will now be available for our program. We can then fill in the sequence array with a series of initial values.
Creating a sequenced event using a 1D array.
We will now create a sequenced pattern on our output card using a 1D array. The pattern will be the same as what we programmed for our Sequence Array above.
Let’s add another tag called Pointer. This will be used to select the value in our array. It will have the initial value of 1 and be an integer, 16 Bit Unsigned. This pointer tag will be the index pointer for our sequencer.
When Switch 1 is on, our input sequencer value is transferred to the digital output bits.
The pointer is used as an index for the sequencer. Every other second we will use the math instruction to increment the pointer value by one. We always compare the pointer to a value of 30. Once the pointer is greater than 30 a value of 1 is then moved back into the pointer. This will reset our sequencer.
When switch 1 transitions from on to off the pointer gets reset by moving the value of 1 into its location.
You can see that using arrays with index pointers can be very powerful. Another simple sequencer that you can program would be a traffic light. This can easily be done by using the same program above and change the array information to correspond to the light sequence.
Download the PLC program here.
Watch the video below to see the array sequencer that we created in action running on our Productivity 1000 Series PLC.
Productivity 1000 Series PLC form 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 Programming Software (Free Download Link)
This software contains all of the instruction sets and help files for the Productivity Series.
Next time we will continue to look at the array functions in the Productivity 1000 Series PLC. This will include the following array instructions:
Shift / Rotate Array
Watch on YouTube : Productivity 1000 Series PLC Array Functions Part 1
If you have any questions or need further information please contact me.
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.
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 as a free download. The link is included when you subscribe to ACC Automation.