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.
We will define 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 2000 Series PLC arrays.
Previously in this Productivity 2000 series PLC, we have discussed the following:
P2000 Hardware Features – Video
Productivity Suite Software Install – Video
Communication (System Configuration) – Video
First Program – Video
Debug Mode – Video
PLC Program Documentation – Video
PLC CPU Display – Video
PLC Online Programming – Video
PLC Tag Database – Video
Ladder Logic Contacts – Video
Ladder Logic Outputs – Video
Timers – Video
Counter – Video
Productivity 2000 PLC Ladder Logic Math – Video
Data Handling Instructions
Part 1 – Video
Part 2 – Video
What are Arrays?
Arrays are like spreadsheets.
The spreadsheet is made up of columns and rows. The coordinates of columns and rows address individual cells. The information in the cell can be any variable type we want. In our example, the highlighted cell is C3.
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 elements in the Array called Widget Progress is Widget Progress (4), (2).
Format: Array Name (Row), (Column)
Note: The 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) – a 1D array
Widget Progress (Pointer_Row), (Pointer_Column) – 2D array
Creating an Array
Call up the tag database. Main menu | Edit | Tag Database. You can also access this under the Application Tools menu in the Write Program folder.
Select the Add Tags button at the bottom of the Tag Database window.
We can now assign 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 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 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. This pointer tag will be the index pointer for our sequencer. It will have the initial value of 1 and be an integer, 16 Bit Unsigned.
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 constantly compare the Pointer to a value of 30. Once the Pointer is greater than 30, a value of 1 is moved back into the Pointer. This will reset our sequencer.
When switching one transition 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 quickly be done by using the same program above and changing the array information to correspond to the light sequence.
Download the PLC program here.
Watch the video below to see the array sequencer we created running 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 1
If you have any questions or need further information, please get in touch with me.
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.