PWM

PWMIntroductionwiringOutput PWM signal

 

Introduction

In this tutorial, we will learn how to use the K230 GPIO interface to output PWM signals.

What is PWM signal?

PWM ( Pulse-width modulation ) is the abbreviation of pulse width modulation. Pulse width modulation is a digital encoding method for analog signal levels. Pulse width modulation PWM is a way to reduce the average power transmitted by the electrical signal by dispersing the effective electrical signal into discrete forms. Therefore, according to the area equivalence law, the waveform of the corresponding amplitude and frequency required for synthesis can be equivalently obtained by changing the time width of the pulse. The PWM signal adjusts the changes in the signal, energy, etc. by adjusting the change in the duty cycle.

wiring

Since the PWM signal cannot be seen directly, an oscilloscope is needed to view it. Please bring your own oscilloscope.

Connect channel 1 of the oscilloscope to IO42, channel 2 to IO43, and GND to ground.

image-20250424173910133

Output PWM signal

Copy the following code into CanMV IDE and run

Then observe the level signal on the oscilloscope. As shown in the figure below:

image-20250424171715091