Positioning programs are used to easily generate Pulse Train Output (PTO) signals to control the position and speed of a stepper or servo motor. Positioning programs can sometimes be referred to as PTO, position, and pulse-direction functions.

In this guide, we focus on connecting an HMI, a PLC, a stepper driver to control a motor’s position and speed. You’ll learn how motor position works, how to program different position controls using a PLC, and how to establish connection between all devices.


When discussing positioning, or precision positioning, generally we are referring to rotating a motor an incremental amount to achieve a desired position. For example, in a CNC machine where the spindle needs to move 6 inches, we can send a certain amount of pulses to the motor to translate the rotational movement of the motor to a linear distance.

How do pulse outputs translate into motor rotation?

A stepper motor has a certain number of steps per rotation, when a motor driver sends a single pulse, the motor will take one step.

For example, if a stepper motor has a specification of 400 steps/rotation – it will take 100 pulses to rotate ¼ of a full rotation and 400 pulses to rotate the shaft one full rotation. That means that every step is equivalent to 0.9 degrees per step.

How do PTO signals control motor speed?

Pulse Train Output signals are electrical signals that a controller, such as a PLC, outputs to precisely control positioning and speed. PTO signals vary from Pulse Width Modulation (PWM) signals because you can only change the frequency of the signal while the duty cycle is set to 50%. To learn more about PWM signals and check out our tutorial on “How to Control the Speed of a Motor Using Pulse Width Modulation”.

Speed can be directly controlled by adjusting the number of pulses that are output in a certain amount of time.

Figure 2: Step speed illustration

Using our previous example, if we send 400 pulses every minute that would mean we will rotate the shaft of the motor one full rotation every minute. Compared to if we send 4000 pulses every minute, we will rotate the shaft 10 full rotation every minute.

For this example, we will be using a Maple HMI, a Maple PLC, a motor driver, and a stepper motor to create simple motor positioning demo that incorporates visual elements, simple programming, and general positioning control design.

A typical positioning system has a controller, in our case a PLC, that determines what signals need to be sent for a particular position and speed control. Those signals are then sent to a dedicated motor driver that interprets the commands and sends the necessary pulses to the motor. We want to use a motor driver that matches the specification requirements of our motor, which is determined by what our project objectives are.

Using an HMI is not a requirement for positioning; however, it will allow you to visualize, interpret data, and control positioning in a straightforward manner. In addition, we will use a stepper motor to easily control positioning without requiring any feedback.


Before we dive into control of a positioning program and configuration, let’s first look the breakdown of the integrated digital I/O of the Maple PLC CPUs and how they are used in positioning.

Table 1: Maple PLC CPU digital input and output terminals

Digital input pins are available to easily implement upper and lower limits for each axis by wiring them to physical sensors. There are also additional digital inputs for Origin Point Return (OPR) control which will be covered later in the article.

Whether using a Modular PLC or the Micro, there are four digital output pins used to send PTO signals to control up to two axes. Two pins are (Y10 and Y12) are used to send pulse signals to control how many steps the motor is taking and two more pins (Y11 and Y13) to determine which direction the motor is rotating. Below you can see how positioning signals are sent from the Maple PLC to the motor driver.

Figure 4: Example of Maple PLC CPU digital output signals controlling positioning

The PLC will send pulse signals with the first digital output (Y10) and the logic output signal with second output (Y11). In simple terms, Y10 will tell the driver how many steps need to be taken and Y11 will equate to what direction the motor will turn. When Y11 is set to ON the motor drive will send Clockwise (CW) positioning instructions when pulse signals are sent, and when Y11 is OFF the driver will send Counterclockwise (CCW) positioning instructions when pulse signals are sent.

Note: Maple PLCs have two-axis position control, however for simplicity we will only program one-axis in this article. Please refer to the position control manual for more information.

Like most control systems, the requirements of your system will affect the control mechanism you choose, which ultimately may require a combinate of control methods. For example, you may have a dedicated set of movements you want your motor to complete but also need the ability to manually adjust for rare situations.


There are numerous ways for motor positioning to be programmed, from simple controls to complicated multistep controls. However, this is all dependent on the controller you choose for your positioning project. In this example we will use a Maple PLC that has three main control functions.

Manual positioning allows users to generate a general-pulse output to adjust positioning. This positioning method is usually referred to as Jogging or Inching because the main function is to make small mechanical movements to reposition to the desired location.


Like how a robot may have predetermined movements, position instructions allow users to easily program known movements that can be triggered in single steps or continuously. These instructions allow you to fine tune each step to your specific needs.


Origin Point Return (OPR) is a function that allows users to create a starting position and carry out position controls towards the starting point. Digital inputs on the PLC are used to determine positioning and return, for example, a workpiece to that start position in a controlled manner.


Like most control systems, the requirements of your system will affect the control mechanism you choose, which ultimately may require a combination of control methods. For example, you may have a dedicated set of movements you want your motor to complete but also need the ability to manually adjust for rare situations.


How are positioning parameters configured in MapleLogic?

When initially opening a new positioning program we first need to set a starting address for all control registers and then configure the parameters. The first two tabs of our positioning program include the starting address and the parameters of the two axes in our positioning program

Start Address: Sets the range of registers that will be used for the operation data which can be accessed to monitor or control motor operations. Setting the start address to D0 will make the range D0-D19 used for position control

Basic Parameters: are used to set output pulse type and the primary speed settings.

Extended Parameters: are used for setting position limits, JOG speed settings, and completion signals.

OPR Parameters: settings regarding the OPR control method which include OPR method selection, OPR speed limits, and direction configuration.

For more detailed information on the parameters please refer to section 1.6 in the positioning user manual.

How are position instructions preconfigured?

The position data tabs allow you to configure up to 30 position data for each axis and can be accessed by clicking the “Position Data” tab for the intended axis. Each step can be configured to have a different control function (including position, speed, and loop control), acceleration/deceleration times, operational speeds, etc.

Above you can see we have created 5 position data in the “X-axis Position Data” tab. Each data number allows users to determine the control pattern (continuous or in single step control), the acceleration and deceleration times, the control system, dwell time, operation speed, and position address.

This may seem daunting; however, it is very simple. The first step sets the current position address (POS) to 0, the second step moves the position to an absolute (ABS) 4000 steps, third increments (INC) forward another 2000 steps, fourth increments (INC) forward another 2000 steps as well, and the last step will return to an absolute (ABS) position of -4000. For more information on control systems and parameters refer to the position manual.

How is Position Monitored?

There two ways to monitor motor operations. The first way to is to use the monitor window feature when online with the PLC and the second way is to directly monitor specific data registers.

The position program offers a simple window for current operations that can be accessed by clicking the “Monitor” button in the top right corner of the positioning program (seen in figure 5). Below is an example of monitor window when online with a position project.

In addition, all the positioning data can be accessed by monitoring the positioning addresses. As mentioned earlier if positioning program starts at D0, D0-D19 are used to monitor/control the positioning program. Use the following table:

Table 2: Operation data table used for manual control and monitoring of operations


The main positioning commands Maple PLCs offer.

Manual Positioning

General purpose, or manual, positioning is achieved using the JOG operation. The JOG operation uses the speed settings configured in the extended parameters section of the position program (shown in figure 5).

Using the operation data table below, we can use the control flag register to enable Jogging for the X-axis.

Table 3: X-axis control flag used for manual control

If our positioning program starting address is D0, then by turning on the D0.0 bit as well as the D0.3 but will enable the forward JOG command. If D0.3 is turned off and D0.4 is turned on, the backward JOG will be enabled.

Please refer to section 1.6 in the positioning user manual for the full operation data table for y-axis control.

Positioning Instructions (PSTRTn)

Positioning Instruction, or the PSTRTn instruction, is used to execute three different operations; position data, OPR control, and highspeed OPR control. In logic we’ll use the PSTRT instruction and fill in our parameters

n: Axis number (X=1, Y=2)
n1: Slot Number (CPU= 0 [H0])
n2: Position Data Number (1-30: Position Data Number, 9001: OPR, 9002: Highspeed OPR)
n3: Result Flag

Position Data
Uses the position data preconfigured in the X or Y Position Data tabs. As shown below

Table 4: X-axis position data used to execute preconfigured steps through logic

For each position data users can configure:

  • Single-step increments or Continuous Control
  • Acceleration/Deceleration times
  • Control Systems (Shown in table 5)
  • Operational Speed
  • Positioning Address
  • Dwell time (also known as delay time)

Below is a table showcasing all control system codes and their functions:

Table 5: Control codes used to execute various functions in position instruction control

As an example, using the X-axis position data from figure 4, when Y105 is turned ON position control from No.1 to No.5 will be performed. The D250 register will show any errors that have occurred.

OPR Control
Uses the OPR parameters set in X or Y axis parameter tab to control origin point return control. These settings will allow users to carry out positioning to return to the origin point utilizing the PLC’s digital inputs listed in the table below.

Figure 8: X-axis OPR parameters highlighted

As an example, using the X-axis parameter data from figure 8, when X100 is turned ON OPR control is enabled.

For an in-depth description of the OPR methods available on the Maple PLC see section 1.5.12 in the position user manual, and for a positioning example using OPR control see section 1.11.3.

Highspeed OPR Control
Highspeed OPR uses the same parameters as the normal OPR control, however, when operating will not use the OPR low speed parameter when reaching the origin point. Below is an example of enabling highspeed OPR control using the X-axis parameter data from figure 8.

When X0 is turned ON, highspeed OPR control is enabled.

Position Control (POSCTRL)

Positioning Control, or POSCTRL instruction, is used to conduct position control without using the position data. Position control can be used to change the current position address, change the speed parameter, inching operation, and more. In logic we’ll use the POSCTRL instruction and fill in our parameters:

n1: Slot Number (CPU= 0 [H0])
n2: Control Parameter (command codes shown in table 6)
n3: Result Flag

All position control parameters are listed below with a brief description.

Table 6: Position control (POSCTRL) command code list

After choosing a command code we’ll determine what addresses need to be populated using the table below:

Table 7: Command code register parameters

As an example, using the command code 3 and the device memory code of table 6, we can initiate the inching operation.

Above we can see that the D10 is the start of the position command code. So lets populate the following addresses before our POSCTRL instruction:

For our example, we will utilize the x-axis and the inching command (code 3). To set those we will move 1 into the D10 register and 3 into the D11 register. Now for the last parameter we’ll move a double word of 2000 into the D12 register. What this means is when the X01 register is turned ON the position command instruction will rotate the motor forward 2000 steps.

For more information and detailed instructions on other command codes see section 1.8.2 in the Position User Manual.

After all configuration changes are made, we can layout which Modbus addresses are used to control the motor. Below is the table of Modbus addresses we will use to control the stepper motor

Table 8: Mapping Modbus addresses used between HMI and PLC

Addressing can sometimes feel daunting, however, if you layout all the addresses used to control your motor like we do in the table above – it becomes straight forward.


Next, we will need to do is download our respective product software’s, EBPro for our HMI and MapleLogic for our PLC. Below are links to the direct download of each software:

After you have installed both software programs, we can start configuring and programming our demo application. The HMI and PLC programs used in this demo project can be downloaded at the bottom of the page.


Starting off with the MapleLogic (the PLC software), after creating a new project, we double click the PLC parameter window.

Here we can go into the Ethernet tab and change our IP address to 192.168.0.100. This address will be used later for the HMI to communicate with the PLC via Modbus TCP/IP.

Next, we can go into the Modbus tab of the PLC Parameter window and change the slave ID to 1. The addresses listed in this tab will be the Modbus registers the HMI will target via the Modbus TCP/IP protocol.

Lastly, we will set up the master communication from the HMI to the PLC. Start by opening up a new project in EBPro (our HMI software) and go into the System Parameters – here is where we can add our PLC. By clicking the “New Device/Server…” button we can create our “Modbus TCP/IP Master” device to control our PLC – here we make sure the IP address and device default station number matches what the PLC is set to (IP: 192.168.0.100 and Station Number: 1).

For more information on how to setup master TCP/IP communication check out our How to Set Up your Maple PLC and Maple HMI using Modbus RTU and TCP Communications tutorial.


We are almost there! Below is simple scan program, using ladder logic, to control the positioning of the stepper. As you can see we only utilize a few contacts, timers for delays, set bits, and reset bits to control the motor.

Below is the portion of the program that is used to initiate the forward and backward JOG/Inching commands.

Figure 12: PLC ladder logic used to control the forward and reverse JOG commands (MapleLogic)

As you may have noticed when either the forward jog command (Y100) or the reverse jog command (Y101) starts a timer before initializing the JOG commands (D0.3 or D0.4). These timers ensure the jog commands were not accidentally pressed by requiring a press to be held for at least one second before jogging will occur. After either jog command is released, JOG commands are reset by writing to the control flag register (D0) the 1 value, which equates to enabling the x axis for further control.

Moving on to Position Control. This instruction can be used for multiple control features, however for this example we will use it to inch the motor position by a desired amount.

Figure 13: PLC ladder logic used to control the Position Control instruction for inching (MapleLogic)

As you can see on the first scan, we move the value values into registers D100-D102. When initiating the inching position control D100 represents the axis we are targeting, D101 represents the control code (inching), and D102 represents the control data. For ease we will increase or decrease the amount of pulses, register D102, by pressing Y102 and Y013 which will increase and decrease the amount by 1000 respectfully.

Position Instructions are predefined in the position data window of the position program, shown below.

To enable position control we will use the PSTRTn instruction below:

Figure 15: PLC ladder logic used to execute the preconfigured axis data using the Position Instruction command (MapleLogic)

The position instruction will enable the first step in the position data and stop at step 5 where continuous control ends.

It’s always important to include logic to stop operations. The first stop command we use is the deceleration stop command (D0.1) which will stop operation slowly.

Figure 16: PLC ladder logic used to execute the stop command with deceleration enabled

The second command we will use is the emergency stop request (D0.2) which will stop all operation immediately without and deceleration.

Figure 17: PLC ladder logic used to execute the emergency stop command with no deceleration

Moving on to the HMI, we want to create objects we can manipulate to send and receive data from our PLC.

Knowing the Modbus addresses of the PLC registers, in EBPro we can easily add a display object with that address. Below you can see how to create a numeric object by going to the object tab and clicking the “Numeric” button. Here we can specify what device we want to connect with and what Modbus Address we want to control. Above is an example of a numeric display showcasing the current position of the motor. The current position register is read only so we will leave the “Allow Input” box unchecked as well as making sure the “4xDouble” address is selected because the register is a double word.

We can follow similar steps to create a push button by clicking the “Set Bit” button, specifying the Modbus address, and selecting momentary for the button. The button shown in figure 19, will allow the ability to JOG forward.

Similarly, we can create a bit lamp to display the status flags of the motor. This is done by clicking the “Bit Lamp” button and specifying the Modbus address to showcase. Above we created a bit lamp to showcase if the motor is running or is stopped (D2.0).

Expanding on this, we can create a complete HMI project that can control all Modbus registers listed in Table 8.


The last few steps are to wire up all devices, supply power, and download the respective projects to your HMI and PLC. Then run your applications!

This downloadable file has all the necessary projects to recreate and run the positioning demo project described in this article.

Video tutorial coming soon!


For a more in depth tutorial on connecting HMI to PLC, in video form, make sure to check out the following videos below. This video tutorial will guide you step-by-step establishing communication between both devices, covering both ethernet and serial communication, with demonstration on how to create HMI and PLC projects.

Thumbnail for a video tutorial on how to connect Maple HMI to Maple PLC using Modbus RTU and TCP Communications.

Scroll to Top