How to Set Up Pulse Width Modulation (PWM) Using a DC Motor
This tutorial shows you how to turn the digital output on and off for a 24V DC Motor with an HMI+PLC combo, using Pulse Width Modulation, while displaying on the user-interface.
Software Required
Hardware Required
- HMC4070A-M – Other HMC2000/HMC4000 models can also be used
- HMC3-M1212P0200 V2 – Other HMC3 V2 I/O modules can also be used
- 24 VDC Power Supply (4010-0011)
- 24V DC Motor – Other DC Motors can be used. This is just an example
HMI + PLC Combo
Wiring and Circuit Design
Digital Output DC Motor Wiring:
Power Supply:
Red Wire 24V- Power Supply to 24V on I/O
Black Wire 0V – Power Supply to 0V on I/O
Digital Output:
Red Wire Y0: 24V to Motor
Black Wire 0V: Ground to Motor
This wiring diagram can also be applied to any HMC3 V2 I/O Modules with Digital Output capabilities.
Software Code
Ladder Diagram
Structured Text
Another type of IEC Language you can use:
IF Slot01_CH1_Pulse_EnableFlag THEN
RAMPUpDown ( DutyInput, AccelerationSpeed, DecelerationSpeed, TimeChange, Reset ) ;
DutyOutput := RAMPUpDown.OUT;
END_IF;
IF Slot01_CH1_Pulse_EnableFlag THEN
Slot01_CH1_ON_DutyOrMaxFreqSettingReg := any_to_udint ( DutyOutput ) ;
END_IF;
User Interface
Sample Project
The project shown above was designed for the specific hardware mentioned at the beginning of the tutorial and is intended to provide you guidance when programming your unit. If you are using models other than the ones specified in this sample project, similar steps can be duplicated within your own project.
Download MAPware sample project
Resources & Documentation
HMC/MAPware-7000 Resources
- MAPware-7000 Getting Started Guide
- MAPware-7000 Programming Manual
- IEC 61131-3 Programming Guide for MAPware-7000
- HMC3 I/O Module Guide
More
See our Support Center for a complete list of Quick Start and Installation Guides