Pulse Width Modulation (PWM) is the abbreviation of English “Pluse Width ModulaTIon”, referred to as Pulse Width Modulation. It is a very effective technology to use the digital output of the microprocessor to control the analog circuit. It modulates the bias of the gate or base of the transistor according to the change of the corresponding load to realize the output transistor or the base of the switching regulated power supply. Changes in transistor conduction time. This method can keep the output voltage of the power supply constant when the working conditions change, and is widely used in many fields such as measurement, communication, power control and change.
Actel provides a PWM IP core for free: CorePWM. CorePWM is based on APB bus. Its advantage is that it can be connected to Core8051 or CortexM1 processor, which is convenient for users to design SoC. This article will mainly introduce the principle and application of CorePWM.
1. Introduction to CorePWM
(1) PWM control method
There is an important conclusion in the sampling control theory: when the narrow pulses with the same quantity and different shapes are applied to the links with inertia, the effects are basically the same. PWM control technology is based on this conclusion, and controls the on and off of semiconductor switching devices, so that the output terminal can obtain a series of pulses with equal amplitude and unequal width, and use these pulses to replace sine waves or other pulses. desired waveform. The width of each pulse is modulated according to certain rules, which can not only change the size of the output voltage of the inverter circuit, but also change the output frequency.
At present, there are 8 main PWM control technologies, namely: phase voltage control PWM, line voltage control PWM, current control PWM, space voltage vector control PWM, vector control PWM, direct torque control PWM, nonlinear control PWM and resonant soft PWM switch PWM.
Here we will focus on the equal pulse width PWM method in the phase voltage control PWM. The VVVF (Variable Voltage Variable Frequency) device was implemented by the PAM (Pulse Amplitude ModulaTIon) control technology in the early days. The inverter part can only output square wave voltage with adjustable frequency but cannot adjust the voltage. The equal pulse width PWM method is positive. It was developed to overcome this shortcoming of the PAM method. It is the simplest one in the PWM method. It uses a pulse train with the same width of each pulse as a PWM wave. The width or duty cycle of the pulse can be adjusted, and the voltage and frequency can be changed in harmony by using an appropriate control method. Compared with the PAM method, the advantage of this method is that the circuit structure is simplified and the power factor of the input terminal is improved, but there are also In addition to the fundamental wave, the output voltage also contains larger harmonic components.
As shown in Figure 1, it is a PWM wave of equal pulse width. The high and low levels of the PWM are VH and VL respectively. Ideally, VL is equal to 0, but it is generally not equal to 0 in practical applications, which is also an important reason for errors in practical applications.
(2) Advantages of PWM
The advantage of PWM is that the signals from the processor to the controlled system are all in digital form without digital-to-analog conversion. Keeping the signal in digital form minimizes the effect of noise, which affects a digital signal only if it is strong enough to change a logic 1 to a logic 0 or a logic 0 to a logic 1. This is also the main reason why PWM is used for communication at some point, and switching from analog signals to PWM can greatly extend the communication distance. At the receiving end, the modulated high frequency square wave can be filtered out and the signal restored to analog form through an appropriate RC or LC network.
(3) Structure block diagram of CorePWM
The block diagram of the internal structure of CorePWM is shown in Figure 2. It is mainly composed of modules such as time base generator, PWM waveform generator and register interface.
● Time base generator: receive the value of PRESCALE and PERIOD registers, and generate a cycle count of 0 to 255.
● PWM waveform generator: use the input period counter to compare the value of the rising and falling edge registers. When the count value is equal to the value of any edge register, a corresponding PWM waveform output will be generated, and the interrupt register will be reset. renew.
● Register interface: mainly provides the interface of the APB bus protocol of the PWM core.
(4) CorePWM internal registers
All registers in CorePWM are eight bits, and the register description of CorePWM register is shown in Table 1.
In order to make the reader more clear about the use of the CorePWM register, a special example is given, as shown in Figure 3.
PWM is mainly used in fields such as motor control. Figure 4 shows the use of CorePWM to control multiple motors.
This article mainly introduces the CorePWM IP core of Actel FPGA. In addition to CorePWM, Actel also provides IP cores such as UART, SPI, I2C, and TImer. Please pay attention to Zhou Ligong’s website for more information. We have a FPGA team of nearly 30 people to provide strong after-sales service to solve the difficulties encountered by users in the process of product use and research and development.
Responsible editor: gt