Share this

PWM Control Unveiled: Detailed Explanation of the PWM Function in the SC2-C Series PLC

2026-04-06 04:32:08 · · #1

The SC2-C series PLC has 16 inputs and 16 outputs.

16 outputs, DC5~24V, supports NPN type; all 16 outputs are high-speed outputs with a frequency of 200K, and the 16 output ports are allocated to 2 common terminals.

The SC2-C series PLC supports up to 4 channels of PWM (Pulse Width Modulation) output signals and has opto-isolation circuits. The frequency and duty cycle are adjustable, and the output frequency range is 1Hz~200kHz. The output waveform is shown in the figure below. The period of the PWM waveform is t2 (the frequency is 1/t2), the duty cycle is t1/t2, and the amplitude is V1 = 5V/24V. It is generally used to control frequency converters, etc.

The SC2-C series PLC output ports support pulse width modulation (PWM) function, as shown in the table below:

The following is an application example of outputting PWM waveforms based on the PLC's own output I/O.

01. Hardware Wiring

Connect the common input terminal S/S0 of the PLC to 24V, the common output terminal COM to 0V, and the output port OUT15 to the input port IN00; as shown in the figure below:

02. Introduction to PWM Instructions

1. Function block LS_PWM: PWM output instruction

The function block LS_PWM is shown in the figure below. `diFrequency` sets the frequency, `fRatio` sets the duty cycle, `byIndex` specifies the channel, and `xEnable` enables the specified hardware port to output the PWM waveform. When the actual output pulse width and frequency of the PWM reach the set values, `xInVelocity` is set to TRUE.

The channels specified by byIndex are 0-3, and are fixedly bound to OUT12-OUT15.

The parameters of the function block LS_PWM are defined in the following table:

2. Introduction to the instruction error code LS_ERROR

03. Operating Procedures

The PC's IP address is 192.168.1.132 (it should be on the same network segment as the PLC).

The IP address of SC2-C is 192.168.1.3.

1. New construction projects

Open Lead Studio software and create a new project named "Example_SC2C_PWM", as shown in the image below:

2. PWM Programming

1) The variable definitions are shown in the following figure:

2) Write the program as shown in the figure below:

3) For counter configuration and program details, please refer to "Counter_Example Programs"; they will not be repeated here. 3. PWM Testing

1) Open Lead Studio software, open the project "Example_SC2C_PWM", compile it without errors, download the project to SC2-C, and click run, as shown in the following figure:

2) Double-click to open the PWM demo program [PWM_Demo], set the value of “axPWM_En[0]- axPWM_En[3]” to TRUE, as shown in the figure below; at this time, the hardware port OUT12-OUT15 outputs the set PWM waveform, and you can observe the LED light on the corresponding port of the PLC flashing.

3) Double-click to open the counter demo program 【Counter_Demo】, set the value of “xEn_Counter” to TRUE, and read the current counting frequency fFrequency of the counter, that is, the output frequency of hardware port OUT15 is 100000, which is consistent with the PWM setting frequency, as shown in the figure below:

Note: This example only tests the PWM function of the PLC output port. If you need more precise verification of the PWM pulse width and frequency, please use an oscilloscope.

— END —

Read next

CATDOLL 136CM Sasha (TPE Body with Hard Silicone Head)

Height: 136cm Weight: 23.3kg Shoulder Width: 31cm Bust/Waist/Hip: 60/54/68cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm An...

Articles 2026-02-22