ST AN1449 APPLICATION NOTE

AN1449
Application note
ST6200C
universal motor drive software
Introduction
This application note describes the software of a low-cost phase-angle motor control drive system based on an OTP version of the ST6200C microcontroller and a BTB16-600CW snubberless triac. The application has been developed by STMicroelectronics and is available as a low-cost evaluation board UMC01EVAL.
This board can be widely used in many applications such as vacuum cleaners, power tools, food processors and lighting dimmers. The microcontroller implements the following functions:
Speed control: the motor speed is set by a potentiometer on the board. With a look up
table, the MCU can convert speed commands to firing angle delay times. The power delivered to the motor can be adjusted by changing the firing angle with reference to the voltage zero crossing signal.
Soft start: This reduces the motor inrush current at start-up.
Mains period measurement: In order to reduce system cost, a RC oscillator is used on the
UMC01EVAL board as the MCU clock source. However its frequency can vary up to +/­20% because it is highly dependent on power supply voltage and temperature. To control the motor accurately, the mains power line period is measured and used as a time base.
June 2010 Doc ID 8325 Rev 2 1/14
www.st.com
Contents AN1449
Contents
1 Hardware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Board schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Main program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 RC oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Mains period measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Timing definition of main program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Gate pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Phase angle calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Gate pulse generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.4 Interrupt servicing time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.1 Power on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 Soft start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Appendix A Power on reset flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Appendix B Main program flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1
Appendix C Soft start flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2/14 Doc ID 8325 Rev 2
AN1449 List of figures
List of figures
Figure 1. UMC01EVAL board schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 2. Timing definition of main program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 3. Power on reset flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 4. Main program flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 5. Soft start flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Doc ID 8325 Rev 2 3/14
Hardware description AN1449
VCC
VCC
U1
ST62T00
1
2
3
4
5
6
7
8 9
10
11
12
13
14
15
16
VDD
OSCIN
OSCOUT
NMI
VPP/TEST
RST
PB7/AIN4
PB6/AIN3 PB5/AIN2
PB3/AIN1
PB1
PB0
PA3
PA2
PA1
VSS
R7
220K
R6
220K
R4 47K
Q1
BTB16-600CW
R5 470R/1W
C3 470nF/400V
C1
100nF
C2 220uF/16V
D2 1N4148
SPEED
10K
R1 1R/2W
F1
FUSE 10A
D1
BZX85C5.6
R2 3K
C4
100nF
R3 150R
LINE
NEUTRAL
MOTOR
J1
J3
J4
J2
16Pin Socket

1 Hardware description

1.1 General information

The schematics of universal motor control board are shown in Figure 1. On this board, a low cost capacitive power supply generates +5 V voltage for the ST62T00C MCU and its application circuit. The motor speed control is managed by the ST62T00C 8-bit MCU. The MCU clock is generated by on-board RC network. The internal 8-bit timer is used for the triac triggering control. The voltage zero crossing event is detected by two current limiting resistors (R6 & R7). The microcontroller triggers the snubberless triac BTB16-600CW directly with its 20 mA outputs. Three high sink outputs can supply 60 mA gate currents (I
GT=35 mA). This board is able to drive a universal motor up to 1500 W.

1.2 Board schematics

Figure 1. UMC01EVAL board schematics

The hardware environment of the MCU has the following features:
The MCU oscillator is implemented by an on-board RC network.
No external reset circuit is used, this function is handled by the low voltage detector
option of the ST62T00C.
The voltage zero crossing event is detected through current limiting resistors (R6 &
R7).
R1 is reserved for future use. It must be replaced by a jumper when the board is
running in open loop mode. In closed loop, it is used as a shunt resistor. It can measure the motor peak current.
4/14 Doc ID 8325 Rev 2
AN1449 Main program

2 Main program

2.1 RC oscillator

In most applications, the MCU internal clock is supplied by a quartz crystal or a ceramic resonator. On this board, for cost reasons, it has been chosen to generate the system clock with an external resistor (the capacitor is implemented internally). However as a result of this choice, clock accuracy is only about +/-20% because the RC oscillator frequency is highly dependent on supply voltage and temperature variations. For more details, please refer to the “clock and timing characteristics” section of the ST6200C datasheet.

2.2 Mains period measurement

To obtain a more accurate clock source for driving the motor, the AC power line period is measured by the microcontroller. It is used as a system clock reference. The voltage zero crossing detection is performed by the ST62T00C NMI interrupt with two current limiting resistors (R6 & R7).
Note: For the ROM version, as the injection is forbidden on the NMI pin, it is recommended to use
another pin with interrupt capability.
The interrupt (falling edge only) is generated at each negative voltage zero crossing event. It triggers the internal 8-bit Timer Counter Register (TCR) to measure the power line period. The result is stored in the T50HZ register. In 220 V/50 Hz applications, the value of T50HZ register corresponds to 20 ms when the timer input clock division factor in the Timer Status Control Register (TSCR) is 64. The same value corresponds to 10 ms when the timer input clock division factor is 32.

2.3 Timing definition of main program

The basic principle of the phase angle control algorithm is very simple. The ST62T00C can detect the beginning of a full wave by detecting the negative voltage zero crossing event, after which it can calculate the phase angle, load the phase delay time PHASE in the 8-bit Timer Counter Register (TCR) and start the timer counting.
When the timer expires, the Timer Counter Register (TCR) is reloaded with a value in T50NEW register which is equivalent to the duration of one half cycle (e.g. 10 ms at 50 Hz), after which the first TRIAC triggering pulse is generated. Be aware that the value in the T50HZ register must be compensated with a look up table (RCTAB) in order to eliminate the fluctuation of the RC oscillator frequency within one full wave cycle. The compensated value is stored in the T50NEW register. To obtain the duration of a half cycle, we can use the same value in the T50NEW register and divide the corresponding timer input clock frequency by 2. It can be easily implemented by selecting the division factor of prescaler bits in the Timer Status Control Register (TSCR).
The time base T50HZ of the power line period is averaged every 16 full wave cycles (e.g. 320 ms at 50 Hz) in order to eliminate the influence of the RC oscillator. After that, the potentiometer measurement is performed with the internal A/D converter. The new speed command goes through the ramp up or down subroutine and speed look up table (VREFTB). The new phase angle in the PHASE register for the next cycle is computed. In addition, as mentioned above, the full wave timer value in register T50HZ must be
Doc ID 8325 Rev 2 5/14
Loading...
+ 9 hidden pages