Share this

Photovoltaic sinusoidal inverter power supply based on 68HC908MR16 microcontroller

2026-04-06 05:07:48 · · #1
1 Introduction With the increasing severity of the energy crisis and the growing awareness of environmental protection, the development and utilization of new energy sources are receiving more and more attention. Solar energy, as an inexhaustible, efficient, and pollution-free energy source, has recently gained even more popularity. The photovoltaic sinusoidal inverter power supply system introduced in this paper is a power supply system suitable for residential use, especially for users in remote western regions with little or no electricity. With the ongoing development of western China, its market prospects will undoubtedly become increasingly broad. [b]2 Inverter System Structure and Principle[/b] 2.1 Basic System Structure The basic system structure block diagram is shown in Figure 1. As can be seen from the figure, the solar cell array first charges the battery through the charging circuit, thus obtaining a basically stable DC voltage. Then, the DC voltage is inverted into high-frequency AC voltage by the inverter circuit. Finally, it is stepped up by the power frequency transformer and filtered by the filter circuit to become a 50Hz, 220V sinusoidal AC voltage. The entire system is controlled by the MR16 microcontroller. Its core part is the digital PI regulator composed of SPWM wave generation and feedback based on the output AC voltage sampling. [img=473,262]http://zszl.cepee.com/cepee_kjlw_pic/files/wx/dyjsyy/2002-12/48-1.jpg[/img] 2.2 About the MR16 Microcontroller The 68HC908 MR16 microcontroller is a low-cost, high-performance eight-bit microcontroller. It features 32KB of erasable on-chip flash memory and 768 bytes of RAM, which is sufficient for this system. It has a dedicated 6-channel PWMMC module for motor control, suitable for single-phase and three-phase inverters. This module also has 4 FAULT pins for fault protection, which can quickly block the PWM output without interruption in case of a fault. It has a clock generator module that allows selection of an external crystal clock or an internal phase-locked loop clock. The internal phase-locked loop clock selected in this system generates a precise 8MHz internal bus frequency, ensuring the system's frequency accuracy. It has a programmable AD clock with a conversion time as fast as 2μs, minimizing interrupt execution time. It has an SCI serial communication interface that can operate in full-duplex or half-duplex mode, reliably enabling serial communication with an external keyboard monitoring system. 2.3 Inverter Main Circuit The main circuit adopts a single-phase full-bridge inverter circuit as shown in Figure 2. The switching devices are power MOSFETs, suitable for low-power devices, with fast switching speed and high operating frequency. The gate drive signal of the switching transistor originates from the SPWM wave generated by the MR16 microcontroller and then passed through the drive circuit. The output of the full-bridge inverter is a high-frequency SPWM wave, which is boosted and filtered by a transformer to obtain a standard 220V, 50Hz sinusoidal AC voltage. [img=352,196]http://zszl.cepee.com/cepee_kjlw_pic/files/wx/dyjsyy/2002-12/49-1.jpg[/img] 2.4 Formation of SPWM Wave The 68HC908MR16 microcontroller has a dedicated PWMMC module for motor control, which can operate in 3 pairs of complementary modes or independent modes and includes 6 PWM outputs. In this system, it is initialized to operate in 3 pairs of complementary modes, that is, the two PWM signals of the same bridge arm are complementary. During initialization, a counter value is written to PMOD(H) to determine the carrier frequency, i.e., the switching frequency. The real-time pulse width calculation of the PWM wave is performed by an interrupt program. An interrupt is triggered each time the PCTN(H) counter in the PWMMC module reaches the value in PMOD(H). A table of sine values ​​from 0 to 360° is pre-stored in a specific area of ​​the FLASH memory. Each time an interrupt occurs, a sine value is retrieved from this table, calculated, and then sent to the PVALS(H) register. The microcontroller compares the value in PVALS(H) with the value in PMOD(H) and automatically generates an SPWM signal, which is then emitted from the PWM pin. To prevent two transistors in the same bridge arm from conducting simultaneously, a value is written into the DEADTM register in the DEADTIME register of the no-signal generator to determine the dead time. This system is designed with a dead time of 2.5μs and a carrier frequency of 10kHz, and a sine table containing 200 amplified sine values ​​is created. The PWMMC module also has four fault protection ports, FAULT1 to FAULT4. When the port is high, the PWMMC can block the corresponding PWM output according to the initialization setting. The overcurrent protection in this system utilizes this function. When an overcurrent occurs, the FAULT1 port is set, thereby blocking all six PWM ports. This system operates the PWMMC in center-aligned mode. At a PWM clock frequency of 8MHz, the carrier period is calculated as: carrier period = 1/10k = PMOD(H) × (1/8M) × 2. Therefore, this system must initialize PMOD(H) = $0.190 (Note: $ is the hexadecimal symbol in MR16). 2.5 System Control Structure This system achieves voltage regulation control through a digital PI regulator. The system control block diagram is shown in Figure 3. The feedback signal comes from the AD sampling of the AC voltage. To ensure accuracy, this system uses a transformer for voltage sampling. The initial voltage is taken from the soft-start output. Soft-start is used to avoid large peak currents during startup. It increments by 1 each time to reach the required voltage. After soft-start, the given voltage corresponds to 220V. To enhance speed, this system uses a combination of feedforward and feedback control. To improve the dynamic output characteristics, this system employs a fuzzy control method that adjusts the proportional and integral coefficients based on the deviation. When the deviation is large, the proportional and integral coefficients are also large; when the deviation is small, the proportional and integral coefficients are also small. This significantly reduces overshoot, easily stabilizes the system, completely eliminates integral saturation, and enhances the system's adaptability. [img=353,136]http://zszl.cepee.com/cepee_kjlw_pic/files/wx/dyjsyy/2002-12/49-2.jpg[/img] **3. Serial Communication** To enhance the system's adaptability to different environments, it is necessary to monitor and adjust parameters. This system uses serial communication technology to communicate with an external keyboard monitoring system. The program uses a polling method to periodically send detected data to the outside world. The detected data includes solar cell voltage, charging current, battery voltage, DC side current, output voltage, output current, and heat sink temperature. When a fault occurs, a fault signal is sent first. When parameters need to be modified, data is received and the corresponding parameters are modified. A checksum method is used to verify the accuracy of the data communication. The hardware uses the MAX485 from MAXIM as the interface chip, enabling it to operate in half-duplex mode. Optical isolation is used to enhance the system's anti-interference capability and improve reliability. 4. System Software Design The system software adopts a modular design, including an initialization module, protection module, regulator module, communication module, and interrupt program module. Except for the interrupt module, all other modules are placed in the main program, the flowchart of which is shown in Figure 4. [img=203,270]http://zszl.cepee.com/cepee_kjlw_pic/files/wx/dyjsyy/2002-12/50-1.jpg[/img] The initialization module mainly completes the system initialization and assigns initial values ​​to each variable unit and register unit. The protection module performs fault judgment based on voltage and current sampling values ​​and blocks the PWM output when a fault occurs. Protection includes battery undervoltage, battery overvoltage, system overload, and overheat protection. Among them, the battery undervoltage and overvoltage protection can achieve self-recovery, that is, when the battery voltage is detected to have returned to normal, the system soft-starts and resumes normal operation. Overcurrent protection, requiring rapid response, employs hardware protection. When an overcurrent occurs, all PWM outputs and all drive circuits are immediately blocked, only resuming operation upon reset. Software can determine if overcurrent protection has occurred. The regulator module performs PI regulation to stabilize the system output voltage at 220V, and also includes soft-start. Its input parameter is the soft-start output, and the output parameter M is sent to the interrupt module for PWM pulse width calculation. By adjusting this parameter in real-time, the pulse width value can be changed, thus making the output follow the given parameters. The interrupt program module generates the SPWM waveform and samples AC voltage and current parameters. The interrupt input parameter is the PI regulator's output parameter M, which participates in the pulse width calculation, i.e., the calculation of the PVALX(H) value, thereby changing the duty cycle and thus regulating the output voltage. Following the sampling method of SPWM rule 2, and combining the setting of PWMMC during initialization, the real-time calculation formula for pulse width is as follows: Positive half-cycle: PVALX(H) = PMOD(H)/2 + M × SIN(PTR) Negative half-cycle: PVALX(H) = PMOD(H)/2 - M × SIN(PTR) Where PTR is the sine table pointer, and SIN(PTR) is the sine value corresponding to the PTR pointer. [b]5 Conclusion[/b] Based on the above ideas, a prototype was made, and a relatively standard 220V, 50Hz sine voltage was finally obtained. The soft start was also very smooth, with a frequency error ≤0.1% and an output voltage error ≤0.5%. Due to the use of a 10kHz carrier frequency, a 20kHz high-frequency signal was obtained on the primary side of the transformer, with no noise. Under the above control method, the output voltage can be kept stable quickly when the system is suddenly loaded or unloaded. Furthermore, the serial communication with the external keyboard monitoring system is good, with strong practicality and reliability. The output voltage waveforms under no-load and load conditions are shown in Figures 5 and 6. [img=269,184]http://zszl.cepee.com/cepee_kjlw_pic/files/wx/dyjsyy/2002-12/50-2.jpg[/img][img=269,190]http://zszl.cepee.com/cepee_kjlw_pic/files/wx/dyjsyy/2002-12/50-3.jpg[/img] [b]References[/b] [1]Huang Jun, Wang Zhaoan. Power Electronic Converter Technology [M]. Machinery Industry Press, 1999. [2]Li Chaoqing. PC and Microcontroller Data Communication Technology [M]. Beijing University of Aeronautics and Astronautics Press, 2000. [3]Cao Chengzhi. New Technologies for Microcomputer Control [M]. Machinery Industry Press.
Read next

CATDOLL 88CM Q Full Silicone Doll

Height: 88cm Silicone Weight: 14kg Shoulder Width: 25cm Bust/Waist/Hip: 49/45/51cm Oral Depth: N/A Vaginal Depth: 3-13c...

Articles 2026-02-22