1 Overview
PHILIPS 51LPC series microcontrollers currently include seven models, P87LPC760/1/2/4/7/8/9. 51LPC provides high-speed and low-speed crystal oscillator and RC oscillation modes, which can be selected programmably; it has a wide operating voltage range of 2.7~6.0V, programmable I/O port line output mode selection, optional Schmitt trigger input, LED drive output; it has an internal watchdog timer and provides power-off detection simulation function, which minimizes the use of external components. These features combined with the improved C51 structure make it possible to have more choices when designing high-integration, low-cost and low-power control circuits. This series is mainly used in low-power application fields that have strict requirements on system cost and high anti-interference performance of the system. It has been widely used in industrial control fields such as electronic positive energy meters, IC card water meters, electronic scales, disinfection cabinets, LED displays, gas meters, etc.
This article introduces a method of controlling an inductive load AC motor using the LPC series microcontroller P87LCP761 and a three-quadrant bidirectional thyristor (Triac) under mains power conditions. A new current zero-crossing detection method is used, and bypass resistors do not need to be added to the load current line. The power supply of the control circuit is provided by a single-correlation wave rectification. The high anti-interference performance of the LPC allows this system to be completed with very few external parts. This solution can be implemented using the on-chip RC oscillator and comparison of the P87LPC761 series microcontroller, or other LPC series chips with on-chip PWM, ADC and DAC functions. This system can be used to control motors (AC/DC), valves, pump lamps, etc., and is widely used in lighting, HVAC, power tools, instruments and industrial control. Table 1 shows the pin functions of the P87LPC761.
Table 1 P87LPC761 pin functions
2 Principle
2.1 Load voltage zero-crossing control - single input detection
Block diagrams 1 and 2 are the general block diagrams of this application. The circuit is powered directly from the mains, and the phase control timing depends on the mains voltage zero crossing detection (Voltage Zero Crossing) (see Figure 1) or the load current zero crossing detection (Current Zero Crossing) (see Figure 2). Which detection method is used depends on the actual application. The control module calculates the generation time, and the LPC can directly absorb the gate current of multiple Triacs. In order to reduce EMI, ensure safe operation and control the phase, it is necessary to trigger the Triac at current zero crossing or a specific phase angle. For resistive loads, current and voltage zero crossings are consistent; for inductive loads, current lags behind voltage. The state of the load determines whether the Triac triggers the thyristor based on voltage zero crossing or current zero crossing.
The simplest way to detect the voltage zero crossing is to measure the change in polarity of the mains voltage. The +5V terminal of the LPC is connected to the power line (or neutral point), and the neutral point (or power line) is connected to any I/O port through a current limiting resistor. The voltage at the I/O port is clamped between 0V and +5V by internal clamping diodes, as shown in Figure 3. The microcontroller can read the input state of the input port and detect the zero crossing of the voltage when the state changes from 1 to 0 or from 0 to 1. The level jump point depends on the mode of the I/O port (TTL or Schmitt trigger), and the delay time from the zero crossing point to the detection point depends on the rate of change of the power supply voltage (for example, 230V or 110V system), which must be taken into account. The advantages of this circuit are simplicity and low cost, because only one additional resistor (requires high voltage resistance) is required and any I/O port of the LPC can be used.
2.2 Current Zero Crossing Detection - Current Zero Crossing Window Comparator
The current zero crossing (CZC) is the commutation point of the Triac. CZC detection is particularly important in nonlinear loads because the current zero crossing point and the voltage zero crossing (VZC) point are inconsistent; however, monitoring CZC is not as easy as monitoring VZC because the usual detection method requires a resistor in series with the load, which separates the load circuit and wastes power. The usual method is through amplification and level conversion, and then connected to the microcontroller, which requires at least an additional operational amplifier and its related components. LPC uses a new method to detect the current zero crossing: monitoring the voltage from the gate (VG) to the anode (T1) of the Triac. VG-T1 gives a signal that the Triac is about to commutate because VG-T1 crosses zero at CZC. Depending on the load current and the characteristics of the Triac, VG-T1 can be as low as 0.1V or greater than 1.2V. The circuit shown in Figure 4 uses a window comparator to monitor this voltage to complete the CZC function. Figure 4 Window comparator is used for gate voltage and current zero crossing detectors. VG-T1 can be positive or negative relative to the line voltage, depending on the direction of the load current. That is to say, VG-T1 can be positive or negative relative to VCC+5V. Therefore, before LPC can be monitored, it must be divided by R4 and R5 to make it lower than VCC and within the operating voltage range of the comparator. R1, R2 and R3 limit the voltage to near the zero crossing point. [page]
3. Complete LPC+Triac+Motor(AC) Circuit Implementation
In the control application of P87LPC761 and Triac, the whole system has very low power consumption and high anti-interference performance, so it can be directly powered by the mains through RC step-down and single-phase half-wave rectification, without the need for expensive and bulky transformers, and with very few external parts. This solution is low-cost. Figure 5 shows a general circuit for inductive loads, which is also suitable for resistive loads. Triac can use BTA216 600E. As shown in Figure 4, the load current zero crossing is detected by querying the comparator of P87LPC761 and re-triggering Triac. Interrupt drive can also be used. When starting the motor, the voltage zero crossing is measured and the gate pulse of Triac is triggered to reduce electromagnetic interference, and the software can be controlled and redefined from the beginning of the main cycle to wait for a whole half cycle between starting the load. In this example, the load is turned on by the user button after reset, and the phase angle can be controlled by the button to control the different speeds of the motor. As shown in Figure 5, the speed of the LED light-emitting tube flashing can reflect the motor speed. The faster the LED flashes, the faster the motor rotates, and vice versa; the motor stops and the LED goes out. This circuit can be used in many other similar situations with slight modifications.
Source program list:
The software is compiled on Keil C51 V6.02 and runs normally on the target board. If you use other compilers, you must modify it slightly.
#include
#define uchar unsigned char
#define uint unsigned int
uchar s,x,y=0;
void timer0(void)interrupt 1 using 1 {/*T0 interrupt service routine*/
x=x+1;
if(x/10>s){
if(y= =0){P1=P1&0xfb; /*LED lights up*/
x=0;y=1;}
else {P1=P1|0x04; /*LED turns off*/
y=0;x=0;}}
TF0=0;TH0=-(28/256);
TL0=-(28%256);
}
[page]
void speed(s){ /*Motor conversion control subroutine*/
uchar pulsecount, pulseduration=0;
uint i=0;
uint j=0;
if (((CMP1&0x02))&&!(CMP2&0x02)/*query comparator*/
{for (i=0;i
{for(j=0;j<210;j++);} /*Delay trigger*/
CMP1=CMP1&0xfc;
CMP2=CMP2&0xfc;
pulsecount=1;
{P1=P1&0xfe;
pulseduration=12; /*trigger pulse width*/
while(pulseduration){pulseduration- -;}
P1=P1|0x01;
pulsecount- -;
}
}
}
void Initcomparatior(void){ //Initialize P87LPC761//
PT0AD=0x6f; /*Disable the digital function of P0 port*/
P0=0xff;
P0M1=0x2a; /*P01, P03, P05 are set to high impedance input*/
P0M2=0xd5; /*P00, P04, P06 are set to push-pull mode*/
P1=0xff;
P1M1=0x82; /*P17 is used for VZC detection*/
P1M2=0x05;
CMP1=0x34;
CMP2=0x34;
}
void main(void)
{uchar pulsecount ,pulseduration=0x00;
uint j;i=0;
SP=0x5f;EA=0;
TH0=-(28/256);
TL0=-(28%256);
TF0=0;EA=0;TR0=0;
ET0=1;CMP1=CMP2=0;
Initcomparator();
CMP1=CMP1&0xfc;
CMP2=CMP2&0xfc;s=0;
while(P1_1) {;}
while(!P1_1){;}
while(P1&0x80){};
while(!(P1&0x80)){};
while(P1&0x80){}
while(!(P1&0x80)){};
while(P1&0x80){};
P1=P1&0xfe; //Start the motor
while(1)
{if(P1_1= =0) {
x=0;
while (!x){;}
if(P1_1=0)
{P1=0xff;s=s+1;} //Stop the motor
if(s= =8){s=0;}
while(!P1_1){;} //Wait for the button to be released
while(P1&0x80){};
while(!(P1&0x80)){};
while(P1&0x80)();
whie(!(P1&0x80)){};
while(P1&0x80){};
P1=P1&0xfe;} //Start the motor
EA=1;TR0=1;
speed(s); }
} //Finish
Previous article:The same data memory expansion technology analysis solution as the MCS51 series microcontroller
Next article:Automatic dialer parsing solution with single chip microcomputer as core device
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
- Application Examples of Portable Spectrum Analyzers for Radio Signal Monitoring
- Mentor Online Seminar丨Advanced Application of FPGA Simulation Verification Platform ModelSim
- High Accuracy Split-Phase CT Fuel Gauge Reference Design Using Independent ADCs
- [Xianji HPM6750 Review] HPM SDK Development Environment Construction and Hello World
- Explanation of state machine switching of terminal devices in TI ZigBee protocol stack
- Doomsday wasteland style Bumblebee
- The first industrial-grade waterproof robot dog in China has been launched. Are robot dogs that can swim still far away from us?
- How to choose the right display technology for IoT devices
- New Qorvo IDP President Discusses the Future of RF, MEMS and Power Technologies
- How to choose the right RF module