![matlab drive matlab drive](https://jp.mathworks.com/help/matlabdrive/ug/share_invite_mldo.png)
The DIR signal controls the rotation direction. A positive value (1.0) will make the motor rotating and a zero value will stop the rotation.
![matlab drive matlab drive](https://it.mathworks.com/help/examples/robotics/win64/ControlADifferentialDriveRobotInGazeboWithSimulinkExample_09.png)
The STEP signal from the Signal Builder block controls the movement of the stepper drive. The current amplitude and the stepping rate are selected in the dialog mask to be 2A and 500 step/s, respectively. The movement of the stepper drive is controlled by the STEP and DIR signals received from Signal Builder block. Square-wave current references are generated using the current amplitude and the step frequency parameters specified in the dialog window. In this example, single-phase-on excitation scheme is used because of its simplicity. The switching frequency is variable and dependent on the motor parameters. The ripple in the current waveforms is controlled by the hysteresis band of the comparators. The motor currents are independently regulated by two hysteresis-based controllers that generate the MOSFETs drive signals by comparing the measured currents with their references.
![matlab drive matlab drive](https://se.mathworks.com/help/physmod/sps/ug/dc_motor_control_controller_01.png)
The DC bus is represent by a 28-V DC voltage source. The motor phases are fed by two H-bridge MOSFET PWM converters. The motors parameters are those of a small stepper motor (size 23). This example presents a stepper motor drive using the Hybrid Two-Phase model selected among the options on the dialog window.