introduction
The SPWM variable frequency speed regulation system has been increasingly valued by people due to its advantages such as wide speed regulation range, high power factor, small impact on the power grid, stable motor operation, effective suppression of low-order harmonics, and large capacity. It has always been regarded as a very promising variable frequency solution, and more and more scientific and technical personnel have begun to discuss this topic. Due to the rapid development of power electronics technology and the widespread application of intelligent control technology, the SPWM motor variable frequency speed regulation system currently designed by people has abandoned the old implementation methods that relied on logic circuits, such as comparators and triangular wave generators, and adopted high-performance MCUs plus some special PWM integrated circuits, such as HEF4752 and SLE4520. The system introduced in the text is more capable because MC9S12H256 has an independent PWM channel; in addition, the MCU produced by Motorola has always had the advantages of rich product lines and numerous on-chip resources. Therefore, compared with the solution implemented by Intel 80196, it has certain advantages in terms of debugging method, working speed and difficulty of implementation.
1 Introduction to MC9S12H256 PWM module
MC9S12H256 is a model in Motorola's 16-bit microcontroller series that is positioned for motor control. It inherits the traditional advantage of Motorola's rich resources, with a maximum operating frequency of 24MHz. It has 256K Flash ROM, 12K RAM, 4K EEPROM, 2 SCIs, 1 SPI, 1 I2C bus interface, 8-channel 16-bit timer, 1 6-channel PWM module, 16-channel 10 A/D converter, 2 CAN2.0 interfaces, and 1 LCD driver. The PWM module specifically used for motor control can easily generate bipolar three-phase pulse width modulation waveforms. The PWM module of this chip is introduced in detail below.
The PWM module contains 6 PWM channels, each of which can independently generate left-aligned or center-aligned waveforms. The waveform period, duty cycle and alignment of each channel can be programmed individually, and each channel is also equipped with a dedicated counter to flexibly select different time sources to provide a wider frequency conversion. In summary, the PWM module has the following properties:
*6 independent PWM channels, their period, duty cycle and alignment can be programmed individually;
*Each PWM channel is equipped with a counter to select the clock source;
*Each PWM channel can be turned on or off by programming;
*The starting polarity of each channel can be programmed;
*The period and duty cycle registers are double buffered, which means that only after a cycle ends can they be converted to the new specified period and duty cycle;
*6 8-bit PWM channels can be combined into 3 16-bit PWM channels with higher precision;
* Four clock sources can be programmed to provide a wide frequency range;
*It has the function of shutting down the channel in case of emergencies.
It can be seen that the PWM module of this chip is quite powerful. Undoubtedly, this will help shorten the time for us to design the motor variable frequency adjustment system. The block diagram of the PWM module is shown in Figure 1.
Figure 2 Main circuit diagram
As can be seen from Figure 1, the generation and modification of PWM waveforms are achieved by changing the registers contained in each channel and the system registers, so clarifying the meaning of these registers is the key to successfully realizing the SPWM waveform. However, since the PWM module contains 31 registers, which is a large number, due to space limitations, only a brief introduction is given here.
Among these 31 registers, some are used for chip factory testing, and their specific functions are listed in Table 1. The offset address refers to the offset of the register relative to the PWM base address.
PWMCLK, PWMPRCLK, PWMSCLA, and PWMSCLB in the register are related to the clock source selection. There are four different clock sources in the PWM module: ClockA, ClockB, ClockSA, and ClockSB. Among them, ClockA and ClockSA are used for channels 0, 1, 4, and 5; ClockB and ClockSB are used for channels 2 and 3. ClockA and ClockB are generated by dividing the bus clock by a certain proportional factor (maximum 128), while ClockSA and ClockSB are generated by dividing ClockA and ClockB by a certain proportional factor (maximum 512). Correspondingly, the PWMCLK register is used to set the clock source of each channel, PWMPRCLK is used to set the proportional factor when generating ClockA and ClockB clocks; and PWMSCLA and PWMSCLB set the proportional factor when generating ClockSA and ClockSB. From this we can see that if the operating frequency of the chip is 16MHz, then theoretically, the IGBT's turn-off frequency can reach 1Hz to 16MHz. This is a very wide frequency range. Of course, in practice, the turn-off frequency that the IGBT can withstand also needs to be considered. [page]
Table 1 PWM register function description
Offset Address | Register Name | Function | Access Rights |
$_00 | PWME | 6-channel PWM shutdown control | Read/Write |
$_01 | PUMPOLE | Specify the start level | Read/Write |
$_02 | PWMCLK | Select clock source | Read/Write |
$_03 | PWMPRCLK | Set ClockA/B scaling factor | Read/Write |
$_04 | PUMCAE | Select wavetable alignment | Read/Write |
$_05 | PWMCTL | Controls whether to synthesize into 16-bit PWM channels | Read/Write |
$_06~07 | PWMTST,PWMTRSC | Factory test | Read/Write |
$_08 | PWMCLA | Set ClockSA scale factor | Read/Write |
$_09 | PWMCLB | Set ClockSB scale factor | Read/Write |
$_0A~B | PWMSCNTA,PWMSCNTB | Factory test | Read/Write |
$_0C~11 | PWMCNT0~PWMCNT5 | PWM channel 0~5 dedicated counter | Read/Write |
$_12~17 | PUMPER0~PUMPER5 | Set the pulse period of PWM channels 0 to 5 | Read/Write |
$_18~1D | PWMDTY0~PWMDYT5 | Set the PWM channel 0 to 5 "1" level width | Read/Write |
$_1E | PWMSDN | Emergency shutdown PWM | Read/Write |
2 Hardware Selection and System Block Diagram
From the previous introduction to the MC9S12H256 chip, we know that its internal resources are very rich. Undoubtedly, this brings great convenience to hardware design. Basically, we don't need to expand large peripheral devices; the main expansion is the IGBT drive device, the keyboard and LCD of the human-machine interface, and the photoelectric encoder used to measure the motor speed.
Considering the affordability and price, IMB150-120 is selected for IGBT and EVB840 is selected for its driver. They are both moderately priced and mature in application. Toshiba JR07 is selected for LCD to display motor speed, frequency, working status, etc. As for photoelectric encoders, they used to be mainly foreign products, and the prices were generally very expensive; now there are many domestic manufacturers that can produce them, not only the prices are much cheaper, but the performance is also not inferior, so we selected the PZF series sensors of Changchun Sanfeng Sensor Technology Company, and the keyboard uses the ordinary models available on the market.
The SPWM motor variable frequency speed regulation system consists of two parts: the motor main circuit and the control circuit. The main circuit adopts an AC-DC-AC voltage type IGBT-PWM frequency conversion circuit, as shown in Figure 2. The control circuit is based on MC9S12H256, as shown in Figure 3. It accepts speed data input from an external keyboard and sends it to the LCD for display. At the same time, it calculates the motor frequency based on a certain control algorithm through the input speed and the speed measured by the photoelectric encoder, and then calculates the SPWM waveform parameters. Then, through the built-in PWM module, EXB840 drives the IGBT to generate a pulse width modulation waveform to make the motor rotate at the desired frequency. The interface arrangement of the 6 PWM channels and IGBTs is as follows: channel 5 connects to A+; 4 connects to A-; 3 connects to B+; 2 connects to B-; 1 connects to C+; 0 connects to C-. T1 to T6 in Figure 2 represent 6 IGBTs.
Table 2 Modulation index and carrier ratio value table
Inverter output frequency/Hz | Carrier ratio N | Modulation M | Switching frequency/Hz |
32~62 | 18 | 0.56~0.8 | 576~1116 |
16~31 | 36 | 0.24~0.56 | 576~1116 |
8~16 | 72 | 0.16~0.24 | 576~1080 |
4~7.5 | 144 | 0.08~0.16 | 576~1080 |
3 Algorithms and control strategies
3.1 Selection of modulation and carrier ratio
There is a principle of SPWM frequency conversion, that is, to keep the rotor flux unchanged within the range as much as possible. Therefore, we stipulated the relationship between the output frequency and voltage when designing the algorithm. In order to make full use of the powerful computing function of this model of single-chip microcomputer, we adopt the method of segmented synchronous modulation; within a certain frequency range, synchronous modulation is used to keep the output waveform symmetrical; when the frequency drops steeply, the carrier ratio is increased by one level at a time. Specifically, the entire frequency conversion range of the inverter is divided into multiple frequency bands, and the carrier ratio is maintained constant in each frequency band. As listed in Table 2, the modulation ratio M is defined as the ratio of the peak value Urm of the sinusoidal modulation wave reference signal to the peak value Utm of the three-solution carrier, and the carrier ratio N is defined as the ratio of the triangular carrier frequency ft to the sinusoidal modulation wave frequency fr. Table 2 can be built in Flash for easy reading in the program, and the modulation index needs to be interpolated when looking up the table.
3.2 PWM Waveform Generation
Considering the feasibility of the project and the accuracy of the output waveform, the second regular sampling method is used for sampling, as shown in Figure 4. [page]
Find the sampling voltage value of the sinusoidal modulation wave at the fixed negative peak position of the triangular carrier, which is point E in Figure 4, and then draw a horizontal line through point E to intercept the triangular wave points A and B, thereby determining the pulse width time t2. In this sampling method, the sampling time of each cycle is fixed. According to the symmetry of the pulse voltage to the triangular carrier and the characteristics of the three-phase voltage, the calculation formulas for the three-phase pulse width t and the period t2a~t2c are as follows:
t2a=T[1+Msin(ω1te)]/2
t2b=T[1+Msin(ω1te+2π/3)]/2]
t2c=T[1+Msin(ω1te+4π/3)]/2
t=T[3+Msin(ω1te)]/4
Where: T—period of triangular carrier;
ω1—angular frequency of the sinusoidal modulation wave;
te—negative peak moment of the triangular carrier.
Considering the high-speed computing capability of this type of single-chip computer, we adopt a waveform generation method based on real-time calculation: first store the value of the sine function in the chip's built-in Flash, and calculate the motor's operating frequency according to the expected speed input by the keyboard and the feedback speed of the photoelectric encoder according to a certain control algorithm. Then, look up Table 2 to get M and N, then look up the sine table, calculate the pulse width and period of each phase according to the above formula, and then set the PWM module register of the corresponding channel to generate the desired PWM waveform.
3.3 Control strategy and PWM channel system parameter settings
The control strategy uses slip vector transformation. In addition, there are some other details such as over-current and over-voltage protection. Due to space limitations, they are not introduced in detail here. As can be seen from Table 2, in order to match the corresponding switching frequency, we must select an appropriate clock source for each PWM channel. After analysis, ClockSA is used as the clock source for channels 0, 1, 4, and 5; ClockSB is used as the clock source for channels 2 and 3, and PWMCLK is set to $FD; PWMPRCLK is set to $55; PWMSCLA/B is set to $40, so ClockSA=ClockSB=16M/32/128=2048Hz, so the switching frequency range is (2048/512, 2048)=(4,2048)Hz. Obviously, the switching frequency required by Table 2 is within this range.
4 Software Development Tools
The development tool uses Windriver's embedded C compiler. In order to optimize the compilation quality, a mixed programming mode of assembly and C is adopted, in which tasks such as PWM waveforms that require speed calculation are written in assembly, and the rest of LCD display, keyboard processing, etc. are written in C language. In fact, since MC9S12H256 integrates most of the functional modules, it also brings convenience to software programming. The entire software function mainly includes processing keyboard input, LCD display, control algorithm implementation, and PWM waveform generation. The program is divided into the main program and two timer interrupt service subroutines T0 and T1. The main program completes the slip vector transformation, LCD display, and keyboard processing. T0 interrupts once every triangle carrier cycle to send the real-time calculated PWM waveform data to the relevant register; T1 interrupts once every modulation wave cycle to clear the timer and accumulator to eliminate the accumulated error.
Conclusion
The SPWM variable frequency motor speed control system composed of MC9S12H25 makes full use of the many advantages of Motorola's microcontrollers, such as extremely rich on-chip resources and excellent development tools, which greatly simplifies the development of variable frequency speed control systems.
Previous article:Design of high-precision ultrasonic distance meter based on ATMEGA8
Next article:MCU communication protocol processing
- Popular Resources
- Popular amplifiers
- Research on Improving the Reliability and EMC Performance of Asynchronous Motor Speed Control System
- Research on variable frequency speed regulation system of asynchronous motor based on direct torque control
- SPWM variable frequency speed regulation system based on 8098 single chip microcomputer
- 51 MCU Common Module Design Query Manual
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to choose the capacitor withstand voltage at the power supply end @ [Analog Electronics]
- SystemVerilog and Functional Verification (1)
- MCEWizard software usage for EVAL-M3-TS6-665PN development board
- Have you ever played with any interesting sensors?
- MEMS sensor with AI programmable core (ISPU - intelligent sensor processing unit)
- Application of Finite State Machine in Embedded Software
- I'm begging for a solution for medical ultrasonic atomizer!!!
- How to set the parameters of RC snubber circuit of mosfet switch tube in boost circuit
- Why is there a small series resistor on the digital signal line? (DC2222A LTC2500)
- Why is there a 50mV difference between the two input terminals of an op amp working in negative feedback?