Share this

This article explains how to control the reset of a two-axis stepper motor using an S7-200.

2026-04-06 07:38:27 · · #1

A certain device has two stepper drive systems. The stepper driver model is SH-2H042Ma, and the stepper motor model is 17HS111 , which is a two-phase four-wire DC 24V stepper motor. The requirement is: when button SB1 is pressed, the stepper motor drives the X and Y direction mechanisms to reset. It stops when the X direction approaches proximity switch SQ1 and when the Y direction approaches proximity switch SQ2. The reset is then complete.

(1) Main hardware and software configuration.

1. One set of STEP7-Micro/WINV4 . 0.

2. Two stepper motors, model number 17HS111.

3. Two stepper drivers, model SH-2H042Ma.

4. One CPU 226CN.

(2) Wiring of the stepper motor and the stepper driver.

The stepper motor selected for this system is a two-phase four-wire stepper motor , model 17HS111 . The wiring diagram for this model is shown in Figure 3-2 (only one motor is shown in the figure). The four leads of the stepper motor are red, green, yellow, and blue: the red lead should be connected to the A+ terminal of the stepper driver; the green lead should be connected to the A- terminal of the stepper driver; the yellow lead should be connected to the b+ terminal of the stepper driver; and the blue lead should be connected to the B- terminal of the stepper driver.

(3) Wiring of PLC to stepper motor and stepper driver.

Stepper drivers have two connection methods: common cathode and common anode. This is related to the control signal. Siemens PLCs output a +24V signal (i.e., PNP connection), so a common cathode connection should be used. A common cathode connection means that the stepper driver's D1R- and CP- terminals are shorted to the negative terminal of the power supply, as shown in Figure 3-2. Incidentally, Mitsubishi PLCs output a low-level signal (i.e., NPN connection), therefore a common anode connection should be used.

2. Programming

1. Main Program

2. PTO initialization

3. Stop in the X direction

4. Stop in the Y direction

[Key Points]

The key to writing this program lies in the initialization and forced stopping of the stepper motor by setting SMB67, and its core lies in understanding the SMB67 register. Specifically, SMB67=16#85 means PTO enabled, PTO mode selected, single-segment operation, time base set to microseconds, PTO pulse update, and PTO cycle update.

To stop PTO output, you must first disable PTO output in the control byte and then execute the PLS instruction.

If you don't want to connect a voltage divider resistor at the output, then connecting DC +5V to the 1L+ terminal of the PLC is also feasible.

Disclaimer: This article is a reprint. If there are any copyright issues, please contact us promptly for deletion (QQ: 2737591964). We apologize for any inconvenience.

4. Stop in the Y direction

[Key Points]

The key to writing this program lies in the initialization and forced stopping of the stepper motor by setting SMB67, and its core lies in understanding the SMB67 register. Specifically, SMB67=16#85 means PTO enabled, PTO mode selected, single-segment operation, time base set to microseconds, PTO pulse update, and PTO cycle update.

To stop PTO output, you must first disable PTO output in the control byte and then execute the PLS instruction.

If you don't want to connect a voltage divider resistor at the output, then connecting DC +5V to the 1L+ terminal of the PLC is also feasible.

Read next

CATDOLL Airi TPE Head

This head is made of TPE material. You can choose the skin tone, eye color, and wig style. It is available with a movab...

Articles 2026-02-22