SPWM waveform achievement based STC series MCU (part 2)
2.2 SPWM wave generation method
STC Series MCU produced using the basic principle of SPWM wave is: The value assigned to the carrier cycle, PCA module l, 16-bit capture / compare module register CCAPlH (high 8 bits), and CCAPlL (low 8 bits), PCA timer value of CH ( High-8), CL (low 8) and the modules capture registers compared to the value, when the two are equal, resulting in PCA interrupt. In the break, the call to the module 0 of the PWM pulse width modulation mode, the next one SPWM wave pulse through the CCAP0H loaded into CCAPOL, so that can be achieved without interfering with the update PWM.
Figure 3, namely, real-time calculation by the software a good way unipolar SPWM pulse waveform diagram. A fixed carrier in each cycle, different pulse width values to form a sine form of a table. If the selected module O (P3.7) output of this road SPWM, first PCA Module 0 Mode Register module is defined as the 8-bit PWM mode, the 16-bit counter timers CH, CL Clear, PCA PWM mode Auxiliary register O-ching zero (to ensure capture register EPCOH (high 8), EPC0L (low 8) fixed to zero, PWM wave numerical comparison only with the PCA module 0 capture register CCAPOH (high 8), CC2APOL (low 8) related) , the module l capture register CCAPlH (high 8), CCAPlL (low 8) into the carrier cycle, the high-and eighth 8-bit values, PCA compare / capture module register 1 (CCAPMl) is defined as to be able to compare features, allowed to match the generated interrupts. A pulse-width value of the first sin [0] into CCAP0H, open-PCA modules and low voltage detection interrupt interrupted, open a total break, start PCA count. When the 16-bit counter / timer value and the module 1 capture / compare register values are equal, resulting in a CCF interrupt; to interrupt program, clear interrupt flag bit, to re-register to the module 1 capture CCAPlH (high 8) , CCAPlL (low 8) into the carrier cycle, the high value of 8 and the eighth will be 16-bit counter timers CH, CL cleared, interrupt number of i plus 1, the next a pulse-width value of sin [i] loaded into CCAPOH to prepare for more. Arrive at the same time to determine whether the maximum number of N, if so, interruptions i cleared, while the number of pulse-width-sin [i] value into CCAP0H, to complete a cycle. This cycle, in the P3.7 pin will continue to produce changes in the law as the sine pulse, and thus accurate SPWM wave.
2.3 Software Design
KeilC51 programming using programming languages, and the whole process from the main program and the keyboard interrupt subroutine, as well as the composition of PCA interrupt subroutine. The main program in the system initialization entered SPwM pulse width calculation program to calculate the appropriate pulse width to form a sine table, waiting for interrupt flag bit in response to the different interrupts. SPWM wave is constant because the output must be set to the highest level of PCA interrupt. Once a PCA interrupt flag bit, that is transferred to the implementation of its interrupt subroutine. Figure 4 for the PCA interrupt subroutine flow chart. In the interrupt service routine, pay attention to CCF1 bit and CF flag set by the hardware bit, but can not automatically cleared, you must interrupt the program cleared by software.
At the same time, the system can respond to the keyboard interrupt subroutine from the keyboard to control the output voltage through the liquid crystal display monitors, the current changes and so on.
3 Experimental results
Based on the above design ideas and writing software, with MIC442l four MOSFET drivers to drive the device FQAl60N08 bridge inverter consisting of actual debugging. Figure 5, the output of the grounds of microcontroller STCl2C5410 Two complementary (with some dead time), unipolar SPWM wave. The two complement each other with the direct signal path driver chip MIC4421, the output signal and then drive power inverter, respectively, after low-pass filtered waveforms shown in Figure 6.
4 Conclusion
Experimental results show that this method the circuit structure is simple, practical hardware design and software programming. Use of online technology, combining computing and look-up table, the better solution of the real-time control requirements. At the same time use of SCM as a control device, not just cost reduction, but also convenient debugging, subject to outside interference small, has good practicability and reliability.
To learn more about power inverter, please visite http://www.szpowerinverter.com/ and http://www.bestekltd.com/, or mail to sale38@0102.cn.
订阅:
博文评论 (Atom)
没有评论:
发表评论