PHILIPS 51LPC series microcontroller analysis solution

Publisher:Blissful5Latest update time:2012-06-25 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

/batchupload/articleimg/20120220/13297310507702.gif

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

Reference address:PHILIPS 51LPC series microcontroller analysis solution

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

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号