Introduction
In electric power electronic installations and so on UPS, the control method is the core technologies. The early control method causes the output is the rectangular wave, the harmonic content is high, the filter are difficult. The SPWM technology has overcome these shortcomings well. At present the SPWM production method are many, compiles as follows.
1) uses the discrete component, uses the simulation, the digital blending electric circuit to produce the SPWM wave. This method electric circuit is complex, realizes the difficulty, and is not easy to improve;
2) series and the microprocessor direct connection produces the SPWM wave by SPWM the special-purpose chip SA828, SA828 has the SPWM wave by the regular sampling law, relative overtone and is unable to realize the closed-loop control greatly;
3) (complex programmable logical component) designs using CPLD, realizes the digital SPWM generator;
4) realizes SPWM based on the monolithic integrated circuit, this method control circuit simple reliable, has the SPWM wave using the software, reduced to hardware’s request, and the cost is low, is been small the external interference.
But monolithic integrated circuit’s application already from purely relies on now 51 series monolithic integrated circuits to other many kinds of monolithic integrated circuit development, especially is more widespread by the embedded PIC monolithic integrated circuit’s development application. The PIC monolithic integrated circuit including has the PWM function periphery functional module (CCP), uses this module to be easier through the software to realize SPWM, and has quickly carries out the speed. This article uses the software and hardware union design the method, imitations and so on use area, and realizes based on the PIC monolithic integrated circuit to experiments the contravariant system’s SPWM control.
1 area equivalent SPWM control algorithm
At present produces the SPWM wave the control algorithm mainly to have 4 kinds.
1) natural sampling law;
2) symmetrical regular sampling law;
3) asymmetrical regular sampling law;
4) imitations and so on area.
After theoretical analysis, knows the natural sampling law and the area equivalent characteristics of things is small regarding the regular sampling law overtone, is strong to the overtone inhibiting ability. Also because the PIC monolithic integrated circuit internal does not have the big space to realize the online operation, therefore the natural sampling law does not favor the software to realize. This article pilot system uses imitations and so on area to realize the SPWM control, its principle as shown in Figure 1.
![]() Figure 1 SPWM area equivalent algorithm |
Using sine wave scrap area S1 and the pulse area S2 equal principle, divides into the sine wave half period the N division, then each division’s width for π/N the radian, using imitations and so on area calculates in a half cycle N different pulse width value, will produce the pulse width sequence tabular form saves in PIC monolithic integrated circuit’s ROM, supplies the procedure transfer.
The pulse width produces the fundamental formula is
![]() |
In the formula: M is a moudulation percentage;
N is the carrier ratio, namely in a half cycle’s pulse integer, in the experiment N takes 64;
the k value is 0~63.
The actual pulse width which (1) calculates after the type transforms a time step step produces 64 values the sine tables to store in PIC ROM to supply the transfer. Produces the SPWM pulse width table is one from arrives at the width narrowly, again from width to narrow 64 value table.
2 software and hardware union pilot system
Take the PIC monolithic integrated circuit interior’s two periphery functional module (CCP) as a foundation, uses the PWM function which this module has, software control two group SPWM profile output. Transforms again these two group SPWM wave use supplementary breakover principle 4 groups, enlarges after the isolation actuates the IGBT invertor, realizes to the output the control.
2.1 hardware designs
Experiment hardware system as shown in Figure 2. Chooses the PIC monolithic integrated circuit’s middle-grade series, this series monolithic integrated circuit’s main feature includes:
1) has high performance RISCCPU;
2) besides the procedure branch order is two cycles, other are the monocycle instructions, and only has 35 individual character instructions;
3) 8K×14 FLASH program memory, 368×8 data-carrier storage (RAM) byte;
4) interrupts ability, achieves 14 interrupt sources;
5) the periphery functional module is rich, including 2 16 register’s CCP modules, has the PWM function;
6) including 3 timers, 2 (i.e. TMR2) has 8 cyclical registers with the PWM function related timer, and has 8 pre-frequency dividers and the latter frequency divider.
![]() Figure 2 hardware pilot system |
The contravariant part uses from shutdown component IGBT realizes the single-phase entire bridge inversion. IGBT all controls the electric power electronic device, its control level to insulate the grid field effect transistor, output stage for two-stage power transistor, thus it had both’s merit to overcome both’s shortcoming. Its turn-on frequency is relatively high, the driver power is small, the constitution power converter output voltage ripple is small, the line is simple, most has the application prospect power component now.
2.2 software designs
2.2.1 PIC monolithic integrated circuit’s establishment
In the experiment establishes SPWM the frequency is 20kHz, and the external connection 20MHz crystal oscillator signal, the computation results in the instruction cycle is a time step step for 0.2μs. PIC monolithic integrated circuit CCP the periphery functional module’s PWM function realizes the main dependence related register value hypothesis, and 2 (TMR2) takes PWM by the timer the time base. The related register’s establishment is as follows.
1) the SPWM cycle’s hypothesis establishes by register PR2
(PWM) cycle = (PR2 1) ×4×Tosc× (TMR2) pre-frequency division (4)
In the experiment Tosc is 20MHz, to raise the resolution, the TMR2 pre-frequency division supposes is 1:1, from this calculates results in PR2=0XF9;
2) timer TMR2 control register T2CON hypothesis, because the SPWM frequency is high, the cycle is short, completes the pulse width in each cycle the adjustment to be quite difficult, therefore establishes after this register the frequency division is 1:3, outputs 3 same pulse widths after like this every time the SPWM waves, changes a pulse width value;
3) 2 CCP module control register CCP1CON and the CCP2CON hypothesis two CCP modular control register’s establishment is similar, chooses the CCP module function in the PWM functioning pattern, namely bit3:0=11ⅹⅹ.
4) the CCPR1L pulse width reads in the pulse width value which the register reads when the next TMR2 cycle starts transfers to CCPR1H, through reads CCPR1H the pulse width value to change the PWM pulse width.
5) register TRISC corresponds to CCP1 and the CCP2 input output establishment, should establish as the output form, namely TRISC bit2:1=00.
2.2.2 SPWM profiles produce realize the process
The software control PIC monolithic integrated circuit causes it to have the SPWM profile? Before first, establishes the register value reads in is related the register, when after PIC PWM function opening, TMR2 from 0 starts to count, simultaneously the CCP module pin outputs the high level.
When TMR2≥CCPR1L, the PWM function pin starts to output the low level.
When TMR2≥PR2, then TMR2=0, makes a fresh start another cyclical counting, the PWM function pin starts to output the high level. Simultaneously the TMR2 interrupt flag bit is set at high by the system, namely TMR2IF=1, transfers the execution-interruption service routine.
Because after testing establishes TMR2, the frequency division is 1:3, therefore after 3 PR2 cycles the procedure only then transfers the execution-interruption service routine. Searches the pulse width table in the interrupt service, reads in register CCPR1L the next pulse width value. The next cyclical output’s PWM pulse width namely to just read in CCPR1L the pulse width value, i.e. the pulse width change realizes in the interrupt routine, interrupt routine flow as shown in Figure 3.
![]() Figure 3 interrupt service flow chart |
In the procedure realizes the SPWM output using flag bit F in CCP1 and the CCP2 transformation. When F=1, CCP1 outputs the PWM profile, the CCP2 establishment output is 0 levels; When F=0, CCP2 outputs the PWM profile, the CCP1 establishment output is 0 levels.
3 test results and analysis
The SPWM wave which produces by the PIC monolithic integrated circuit may determine by the oscilloscope. Because the SPWM frequency is 20kHz, in the procedure establishes every 3 pulse widths to be equal, therefore cannot see the pulse width clearly in the oscilloscope from slightly to the biggest complete change process. Pin outputs the SPWM profile by PIC monolithic integrated circuit’s CCP1 section of as shown in Figure 4. In this section of profile’s pulse width by narrow broadens gradually, conforms to the SPWM change rule.
![]() Figure 4 a SPWM profile section |
In the experiment module has two group SPWM waves by PIC monolithic integrated circuit’s two CCP, transforms 4 groups, after these two group SPWM wave after isolation actuation inversion system’s IGBT. Produces two group SPWM profiles correspond the sine wave separately the positive and negative half-wave, complete cycle’s two group SPWM supplementary profile as shown in Figure 5.
![]() Figure 5 two group supplementary SPWM wave |
The pilot system when the DC voltage is 30V load movement obtained sine wave as shown in Figure 6, may know the cycle is 19.9ms, satisfies the power frequency request.
![]() Figure 6 load sine wave |
The pilot system for the single-phase entire bridge inversion system, this kind of working pattern has the obvious frequency multiplication effect. Frequency multiplication effect advantageous filter, may also cut component’s turn-on frequency, reduces the switching loss. Also because this pilot system uses imitations and so on area, is opposite is strong in the regular sampling law harmonic suppression ability. After wave analysis, may when the low voltage does not have the even harmonic basically, and contains the odd harmonic peak-to-peak value to be small, can satisfy the UPS inversion system to the overtone request.
4 conclusions
This article introduces based on PIC monolithic integrated circuit’s SPWM control technology the software and hardware technology unifies well in together, in view of the regular sampling law overtone big shortcoming, using imitations and so on area has suppressed the overtone well. This article has given the concrete hardware pilot system and the software design, after the analytical investigation result profile, indicated that this method output overtone is small, in has the strong use value to the output wave shape quality requirement high UPS inversion system. Now the PIC monolithic integrated circuit application is getting more and more widespread, the electric power electronic technology development more and more fast stage, this kind of software and hardware unifies the control technology also has the big development opportunities in other many application domain.






