Example: Using Arrays

This topic provides an example of using a variable array.

Description

This example will program the RMC for a cylinder sleeve installation machine for a 6-cylinder in-line engine block.

The RMC needs to control the single axis that moves the cylinder sleeve installation head to each cylinder. When it reaches a cylinder, the RMC needs to toggle a discrete output, wait 1 second, then continue to the next cylinder. The "home" position for the head is 0. The position of the cylinders varies by engine type. The PLC stores these various positions and will write them to the RMC.

Method

1. Declare Variables

Create an array to store the cylinder positions. The PLC can write the values to the array just like it can write values to any variable.

2. Declare Discrete Output

Names a discrete output as "Output1":

3. Write the User Program

The user program uses a loop to move to the positions. The label on step 1 is used by step 3 for creating a loop.

3. Downloading the Programmng

To download the programming, in the Project pane, right-click Programming and choose Download Programs to Controller.

4. Testing the Programming

After downloading the Programming node to the RMC, test it out by setting the Positions array elements to certain values on the Monitor tab of the Variable Table Editor and then running the program.

There are several ways to start a user program. In this case, the PLC may send the Start Task(90) command every time it wants to start the program. See the Running User Programs and Issuing Commands topics for details.

 

See Also

Programming Examples Overview


Send comments on this topic.

Copyright © 2025 Delta Computer Systems, Inc. dba Delta Motion