Part Number Hot Search : 
JANTX2N MB86065 00050 0512E BN2222 SR660 TDC1030 MBT555
Product Description
Full Text Search
 

To Download AN416 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  sensorless motor drive with the st62 mcu + triac t. castagnet introduction home appliance applications are requiring more and more electronic control in order to meet new requests and constraints of consumers. microcontrollers have been typically limited to high end applications because their performance appears to be overrated when related to the functions of the application. in reality, home appliances require microcontrollers which trade closely between the compromise between cost and performance. an a.c. universal motor is a cost optimized solution for home appliance applications including food processor and drill applications. this application note shows that the capabilities of simple 8-bit microcontroller allows the design of cost effective speed drive controller with increased functionality. when associated to a triac these microcontrollers become key components in the design of a sensorless speed control. 1 the control of the motor speed an a.c. universal motor is a brush motor with a serial excitation. its stator windings are connected in series with the rotor, and its flux is proportional to the motor current. the motor torque is theoretically proportional to the square of the current, so it is always positive: the speed direction is insensitive to the current direction, and the motor can be supplied in a.c. or d.c. modes. control of the speed is obtained by adjustment of the motor voltage. this control is achieved by a phase angle method in a.c. mode, or by a pulse width modulation method in d.c. mode. AN416 / 02,94 application note
figure 1. the triac is a key device for the a.c. drive of the universal motor. figure 2. a d.c. drive for the universal motor: the p.w.m. chopper with igbt. aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa m aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa m for a fixed motor voltage the motor characteristic shows that the motor speed changes when the torque is varied: the control of the speed requires feed-back of the speed itself. figure 3. universal motor torque t versus the motor current imot. figure 4. universal motor characteristic speed torque (s,t) for a fixed motor voltage umot. t imot t = k.imot : theoretic : real t tn s s n umot is fixed the tachogenerator is a classical speed sensor solution for home appliances. when the accuracy of the speed is not a critical parameter, speed control is also possible without any external speed sensors: thus reducing the number of components in the speed drive. sensorless motor drive with the st62 mcu + triac 2/22
figure 5. speed measurement schematic based on tachogenerator sensor. figure 6. evaluation of the speed s versus current imot & voltage umot of the aa aa aa aa aa aa aa aa aa aa aa aa aa aa n s vcc vs s s sn i1 i2 u1 u2 imot umot : u1 < u2 the back electromotive force (b.e.m.f.) of the motor is a function of the speed and of the current. in the first approach it behaves as a resistance proportional to speed. when the sensor is removed, the speed of the motor is determined by relating the average motor voltage and the average motor current. the controller defines the motor voltage by the triac triggering time (a.c. mode), or by the chopper duty cycle (d.c. mode). a shunt resistor allows the peak motor current to be sensed. such a control method is feasible despite potential motor saturation and the brush voltage. the relations are not linear, however a microcontroller can solve the relations by using look up tables for calculations. to improve the behavior of the speed drive on dynamic operations, the controller can also consider the motor acceleration: this acceleration is represented by the motor current variation, d i mot . this control method can be applied to the home appliance applications when the requirement on the speed accuracy is not very high. the sensor is not required, so the cost of the drive is reduced and its reliability is improved. sensorless motor drive with the st62 mcu + triac 3/22
2 an application example a basic speed drive has been designed with a 500 w a.c. universal motor. an 8 amp - 600 v snubberless triac drives the motor from the 230 v - 50 hz mains. this drive is adapted to a drill application. the speed drive control is fulfilled by an st6220 microcontroller. this 8-bit microcontroller is able to calculate and to control the motor speed with no external sensor by using its on-chip analog/digital converter (a/d) for the current measurement and its 8-bit timer for the triac triggering control. figure 7. application diagram of a speed drive for an 500 w a.c. universal motor. m l n btb 08 600 cw 0.2 / 2 w 100 100 k 100 k 2 x 8.2 k / 1w 1n4004 4 mhz 2m 20 k 100 uf 3k 150 47 nf 5v6 2x33pf ref lim gate sens gnd vs 0 cross oscin oscout st6220 hwd a shunt resistor measures the peak motor current: it is connected in series with the triac, and is referred to the positive supply polarity. two potentiometers define the speed reference and the torque limit. two resistors allow the zero crossing of the line voltage to be captured. the microcontroller triggers the triac directly with its 20 ma outputs. at the triggering point three outputs supply a 50 ma gate current during 2 instruction cycles (24 m s): this pulse will secure the triggering at low temperature or on accidental di/dt. the two outputs then remain on during 500 m s, supplying the gate triggering current (i gt = 35 ma) until the triac latches. the triac driver consumption then becomes less than 2 ma. an auxiliary supply generates a voltage of 5.6v: the low consumption of the hcmos microcontroller and the pulse mode triac triggering minimize the total consumption (i cc <5 ma). so the required current is supplied by two 8.2 k w /1w decoupling resistors. sensorless motor drive with the st62 mcu + triac 4/22
figure 8a. triac triggering with double pulse mode: diagram. figure 8b. triac triggering with double pulse mode: chronogram. pa 1/2 pa0 st 6220 btb08 600cw pa0 pa1/2 gate pulse 50 ma 35 ma 24 m s 500 m s the control program achieves speed control and torque limitation. in addition to these functions, a current measurement task and a.c. phase control are also made by the software. figure 9. block diagram of the st622x microcontrollers. aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa a aaa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa 8 bits data bus port a port b port c watchdog timer 4kb rom 64 bytes ram 8 bits cpu a/d converter 8 bits timer 20 or 28 pins package the speed control determines the motor voltage to be set and the triac triggering delay time t d . at each mains cycle the a/d converter reads the value of the first potentiometer with a 64 step scale. this value defines the speed reference by the means of a 64 byte look up table. the controller compensates for the effect of the motor current on the speed: it determines the current correction through a 64 byte look up table. sensorless motor drive with the st62 mcu + triac 5/22
finally it calculates the time t d by a combination between the speed reference and the current correction. the timer organizes the phase angle control. it is synchronized to the zero crossing of the mains voltage. it delays the triac triggering to t d with an 0.5 % resolution and then generates the 500 m s gate triggering pulse. figure 10. flow chart of the speed control algorithm. initialization wait zero voltage crossing is the current stable ? torque limitation load timer for triggering calculate triggering delay time td < 4 ms ? wait triac triggering and current sensing get speed reference and maximun torque limit yes no yes no the motor current measurement is managed by software, saving the need for external peak detector components. after the triac is triggered, the timer synchronizes the a/d converter to read the shunt resistor. this read is done when the peak motor current is maximum. the peak current instant time t c is determined versus the previous motor current value by the means of a 64 bytes look up table. sensorless motor drive with the st62 mcu + triac 6/22
figure 11. flow chart of the 8 bits timer subroutine operation. timer interrupt stop timer end of gate of gate pulse ? end of sense delay ? trigger triac program pulse width sense the current end of interrupt switch off triac gate program sense delay no yes yes no figure 12. measurement of the peak motor current with software peak detector. 0 crossing gate pulse imot a/d conv (shunt read) tc the torque limitation controls the applied force of the drilling tool. the a/d converter reads the value of the second potentiometer to determine the requested torque limit on a 64 step scale. when the motor current is higher than this limit, the motor voltage is limited to a maximum value by limiting the delay time t d . the total controller program occupies 640 bytes of rom memory, including the look up tables of the speed reference, of the current correction, and of the current sense delay time. sensorless motor drive with the st62 mcu + triac 7/22
this simple program is designed for one application. to change it for another application or motor, only the two look up tables related to the current (128 bytes) need to be modified. this microcontroller plus triac board can thus drive several motor types, or the performance of the board can be optimized for one or several fixed speeds. this flexibility is possible because of the mcu and of its 4 kbyte memory size. the speed of the designed drive ranges from 4000 to 25000 rpm. when the speed reference is 5000 rpm, the speed decreases down to 3500 rpm at 5a peak; it then increases up to 4500 rpm at 8a peak. figure 13. variation of the speed s versus the peak motor current that represents the motor load. s ( rpm ) 5000 imot c. (a) 14 0 8 the torque limitation is mainly effective at low speed: the torque can vary greatly and can decrease the quality of work of the tool. at high speed this limitation becomes useless because the torque and the current are naturally limited by the high impedance of the motor. sensorless motor drive with the st62 mcu + triac 8/22
3 conclusion this note presents a sensorless speed controller for an a.c. universal motor, using a snubberless triac and an st6220 microcontroller. the use of such a microcontroller permits the designer to reconsider the design of the brush motor speed drives: it also offers other methods to control the motor and simplifies the drive circuit by reducing the number of components used. moreover these st62 microcontrollers increase the flexibility of the designed circuit. the same hardware circuit can fulfill the control of various motor types by changing only two look-up tables. other functions such as the user interface (keyboard, display) can be easily added by software to the power control. the same approach can be extended to motor control in d.c. mode where an igbt/mosfet chopper and microcontroller control by p.w.m. are designed. this study has been made with the collaboration of the company b.f.e. (france), which has developped the program and the demonstration board. 4 references [1] - power control with triacs and st6210 mcu an 392 - ph. rabier and l. perier (sgs-thomson microelectronics) [2] - digital control for brush dc motor t. castagnet and j. nicolai (sgs-thomson microelectronics) international appliance technics, may 93 [3] - controlling a brush dc motor with an st6265 an414 - j. nicolai and t. castagnet (sgs-thomson microelectronics) pcim nuremberg, june 93 [4] - improved universal motor drives j.m. bourgeois, j.m. charreton, and p. rault (sgs-thomson microelectronics) an422 - improved universal motor drive with st62 [5] - improvement in the triac commutation an 439 - p. rault (sgs-thomson microelectronics) [6] - data books of o scrs and triacso (dbscrtri/2) and o st62xx microcontrollers o (dbst6st/3) (sgs-thomson microelectronics) sensorless motor drive with the st62 mcu + triac 9/22
appendix 1. sensorless speed control for the universal motor: customization of the control program. the software of the motor control is provided in appendix 3 and is named sens01.asm. it can be adapted to an application by adjustment of the three look up tables (speed reference, peak current instant time, and current compensation). during the adjustments of the speed range and of the peak current detection the current compensation should be inhibited by clearing the current correction register index. adjustment of the no load speed range the potentiometer connected to pb2 (pin 13) defines the speed reference s in conjunction with a 64 byte look up table vitt. this reference corresponds to the motor voltage u mot and to the triggering delay time t d_o at no load. the table vitt contains all no load delay times t d_o to define the speed range of the drive. the table values are defined by the full and minimum speed operation: - the minimum triggering delay time (full speed) is defined by the motor power factor; the triac can only be triggered when its anode current is cancelled; - the maximum triggering delay time (minimum speed) is chosen to keep sufficient motor magnetization, so as to maintain a relationship between motor torque and current. the true decimal values of the tables are calculated by dividing the triggering delay time t d_o by the basic counting step of the timer (48 m s). figure 1. variation of the no load speed versus the reference voltage given by the speed potentiometer. 0123455.6 0 5,000 10,000 15,000 20,000 25,000 30,000 ref so (v) so (rpm) sensorless motor drive with the st62 mcu + triac 10/22
figure 2. variation of the no load triac triggering delay time vs the speed reference voltage. 01234555.6 0 1 2 3 4 5 6 7 ref so (v) tdo (ms) adjustment of the peak current detection the peak current detection is made with the a/d converter connected on pb1 (pin 14). the timer synchronizes this operation to the triac triggering. the counted value is issued from a 64 byte look up table rtmes and it is defined versus the previous peak motor current i mot c . the table rtmes is optimized experimentally at the lowest speed s min . the peak current instant t c after triggering is registered by test for several current values which are chosen between 1 a (8d numeric) and 8 apk (64d numeric). for each case the decimal table value is calculated by subtracting 650 m s (triac triggering task duration) to the peak current instant t c , and by dividing the result by the basic timer step (48 m s). figure 3. experimental plotting of the peak current instant t c versus the peak motor current i mot c at s min = 5000 rmp. 0246810 1,7 1,8 1,9 2 2,1 2,2 2,3 2,4 2,5 imot c. (a) tc (ms) sensorless motor drive with the st62 mcu + triac 11/22
the other values of the table are calculated by linear interpolation on these 4 experimental points. the resulting table is fine tuned by a final test. the table is optimized for a speed s min , but can extended to a larger speed range. adjustment of the current compensation figure 4. motor voltage waveforms with no load and nominal load. td o umot td umot c ( imot c. ) speed control is done with a basic current compensation. when the load (and the motor current) increases, the controller has to increase the motor voltage: it increases the b.e.m.f. to maintain the motor speed. the controller defines a current correction versus the peak motor current i mot_c : c(i mot_c ). the triggering delay time t d is calculated by subtracting the no load triggering delay time t d_o by this current correction: t d_o =t d + c(i mot_c ) the current correction values are stored in the current compensation table couple. this table is optimized for the lowest operational speed s min , and its use could be applied to a larger speed range. the table calculation is done in two steps. sensorless motor drive with the st62 mcu + triac 12/22
figure 5. plotting of the current correction c(i mot_c ) issued form the couple look up table. : preliminary compensation : final compensation imot c. (a) 14 c ( imot c) (ms) 0 3.5 8 1 in the first step the current corrections c(i mot_c ) are determined experimentally to obtain a pure compensation of the current influence, and to maintain the speed round s min . the index register is loaded with an immediate value c, and the peak motor current is measured on test when the motor speed is at smin. the numeric current value defines directly the location of c in the table couple. this test is done for several immediate index values which are chosen between 0 and 80d (3.8 ms). the other values of the table are calculated by linear interpolation on these experimental points. in the second step the effect of the preliminary defined compensation is reduced on lower motor current operation to give a good speed stability on dynamic operation. the current corrections which are decoded on lower motor current (less than 5 apk), will be reduced and the resulting table will be tested on the speed drive. on the higher current range the corresponding corrections will be increased to maintain the speed in its operational range. the resulting table offers a non linear current compensation that gives a good compromise between the speed stability at lower current and the speed decreasing at higher current. sensorless motor drive with the st62 mcu + triac 13/22
appendix 2. circuit diagram p3 neutral c1 1mf/6v3 d1 bzx55b5v6 c5 100nf vdd 1 timer 2 oscin 3 oscout 4 nmi 5 vpp/test 6 reset 7 pb7 8 pb6 9 pb5 10 vss 20 pa0 19 pa1 18 pa2 17 pa3 16 pb0 15 pb1 14 pb2 13 pb3 12 pb4 11 u1 st6210b r3 150 w r4 0.2 w /1% t1 btb08600cw r1 2.7k r2 100 w c3 33pf x1 4mhz c2 33pf r9 33k motor p5 mot1 r5 22k r6 2m p2 100k p1 100k c4 68nf 500w p4 mot2 p6 line d2 1n4007 r7 8.2k/1w r8 8.2k/1w sensorless motor drive with the st62 mcu + triac 14/22
appendix 3. software example program. ;**************************** sens 01 ************************************ ;* * ;* sgs thomson microelectronics * ;* * ;************************************************************************* ;* sensorless universal brush motor control * ;* version 2.0 * ;* december 1993 * ;************************************************************************* ;* this program was developped with the partnership of the company * ;* b.f.e. . the address of our consultant is : * ;* raymond portier, b.f.e. * ;* 24, avenue du general leclerc, 65200 bagneres de bigorre * ;* tel : (33).62.91.03.00 fax : (33).62.91.03.87 * ;************************************************************************* ;* circuit configuration and key features are : * ;* - st6220 microcontroller is designed in * ;* - oscillator frequency : 4 mhz * ;* - hardware watchdog device is implemented * ;* - line zero crossing detection on pb0 with interrupt * ;* - speed reference on pb2 ; torque limitation on pb3 * ;* - torque limitation is stopped * ;* - triac triggering delay time is between 0.4 and 6.5 ms * ;* - triac gate drive on pa1, pa2 with boost on pa0 * ;* - motor current detection on pb1 with adc * ;* - current shunt is 0.2 ohms and detectable peak current is less * ;* 8 amps * ;* - motor current detection time is shown by pa3 pointer * ;* - soft start operation * ;* * ;************************************************************************* .w_on ;************************** register declaration ************************* x .def 080h!m ; index register. y .def 081h ; index register. v .def 082h ; short direct register. w .def 083h ; short direct register. a .def 0ffh!m ; accumulator. pra .def 0c0h ; port a data register. prb .def 0c1h ; port b data register. prad .def 0c4h ; port a direction register. prbd .def 0c5h ; port b direction register. ? prao .def 0cch ; port a option register. prbo .def 0cdh ; port b option register. ior .def 0c8h ; interrupt option register. drwr .def 0c9h!m ; data rom window register. adr .def 0d0h!m ; a/d result register. adcr .def 0d1h ; a/d control register. tpsc .def 0d2h ; timer 1 prescaler register. tcr .def 0d3h ; timer 1 counter register. tscr .def 0d4h ; timer 1 status control register. wdr .def 0d8h ; watchdog register. sensorless motor drive with the st62 mcu + triac 15/22
;*********************** data ram registers ****************************** valr .def 099h!m ; motor current register loop .def 087h ; counter dx .def 088h ; back up of x dy .def 089h ; back up of y dxb .def 08ah ; back up of x dyb .def 08bh ; back up of y flit .def 08ch ; motor control flag register ; b0 indicates 0 crossing pulse ; b2 indicates timer operation on ; triac triggering ; b3 indicates line polarity versus vdd ; b4 indicates timer operation on ; current sensing delay ; b7 indicates timer operation ; b1, b5, b6 are unused here dvalr .def 08eh ; previous valr register value compt .def 08dh ; soft start counter dprb .def 08fh ; back up of port b data register index .def 091h ; motor current compensation register adccou .def 092h ; torque limitation register adccou1 .def 093h adcvit .def 094h!m ; speed reference register adcvit1 .def 095h da .def 096h ; back up of a dab .def 097h ; back up of a ;*********************** equate definition ******************************* ofset .equ 008h ; offset subtracted from motor current ; in current compensation calculation ofset1 .equ 007h ; offset subtracted from motor current ; in measure delay time calculation tgate .equ 008h ; triac gate pulse duration 08h=385us tdtim .equ 053h ; time limit to define priority between ; timer & potentiometers subroutines tdmin .equ 008h ; minimum trig. delay time 08h=385us tdmax .equ 09ch ; maximum trig. delay time 9ch=9.0 ms start .equ 002h ; step of soft start operation ;******************* beginning of program area *************************** .org 0800h ;************************************************************************* ;* speed reference table * ;************************************************************************* vitt .byte 86h,84h,82h,80h,7eh,7ch,7ah,78h .byte 76h,74h,72h,70h,6eh,6ch,6ah,68h .byte 66h,64h,62h,60h,5eh,5ch,5ah,59h .byte 58h,57h,56h,55h,54h,53h,52h,51h .byte 4fh,4dh,4bh,49h,47h,45h,43h,41h .byte 3fh,3dh,3bh,39h,37h,35h,33h,31h .byte 2fh,2dh,2bh,29h,27h,25h,23h,21h .byte 1fh,1dh,1bh,19h,17h,15h,13h,11h ;************************************************************************* ;* current compensation table * ;************************************************************************* couple .byte 00h,01h,01h,02h,03h,04h,04h,05h .byte 06h,07h,07h,08h,09h,0ah,0ah,0bh .byte 0ch,0dh,0dh,0eh,0fh,10h,10h,11h .byte 12h,13h,13h,14h,15h,16h,16h,17h sensorless motor drive with the st62 mcu + triac 16/22
.byte 18h,19h,19h,1ah,1bh,1ch,1dh,1eh .byte 1fh,20h,21h,22h,23h,24h,25h,26h .byte 27h,29h,2ah,2bh,2ch,2eh,2fh,30h .byte 31h,33h,34h,35h,37h,38h,3bh,3eh ;************************************************************************* ;* peak current instant time table * ;************************************************************************* rtmes .byte 0ah,0ah,10h,10h,10h,11h,11h,11h .byte 12h,12h,12h,13h,13h,13h,14h,14h .byte 14h,14h,14h,15h,15h,15h,15h,15h .byte 16h,16h,16h,16h,16h,17h,17h,17h ? .byte 17h,17h,17h,18h,18h,18h,18h,18h .byte 18h,19h,19h,19h,19h,19h,1ah,1ah .byte 1ah,1ah,1bh,1bh,1bh,1ch,1ch,1ch .byte 1dh,1dh,1eh,1eh,1fh,20h,20h,21h ;************************************************************************* ;* initialization * ;************************************************************************* start ldi wdr,0feh ; watchdog initialization ldi x,084h raz clr a ; clear the ram ld (x),a inc x ld a,x cpi a,0d5h jrc raz init ldi pra, 0fh ; port a in push pull output ldi prad, 0fh ; connected at vdd ldi prao, 0fh ldi prb, 0eh ; pb0 in interrupt input, pb1 in analog ldi prbd, 00h ; input, pb4/5/6/7 in pull up inputs, ldi prbo, 03h ; pb2/3 in hi input ldi adr,00h ; a/d conv. initialization ldi adcr,00h ; adc is stopped ldi flit, 00h ; clear logic and application registers ldi compt, 0ah ; ldi index, 00h ; ldi valr, 00h ; ; ldi dvalr, 00h ; ldi adcvit, 09fh ; ldi ior,10h ; interrupt validation ; pb0 interrupt on falling edge reti ;************************************************************************* ;* main program * ;************************************************************************* ;*********************** soft start task ******************************** soft1 jrr 0,flit,soft1 ; wait 0 crossing ( # 1 ) res 0,flit call vit ldi a,tdmax ; ld a,adcvit ; enable this instruction to inhibit sensorless motor drive with the st62 mcu + triac 17/22
; the soft start soft2 jrr 0,flit,soft2 ; wait 0 crossing ( # 2,.., n-1 ) res 0,flit ; reset b0 of flit ld tcr,a ; load timer register ldi tscr,01111100b ; start timer with interrupt & psc = 16 set 7,flit ; control timer cycle with b7 indicator atini jrs 7,flit,atini ; wait end of timer operation subi a, start cp a, adcvit jrnc soft3 jp soft4 soft3 jp soft2 soft4 ld a, adcvit ;***************** main motor control program **************************** main jrr 0,flit,main ; wait 0 crossing ( # n ) res 0,flit main1 ldi drwr,couple.w ; define motor current compensation ld a, valr ; a <= valr motor current measure subi a, ofset ; a <= valr - ofset , jrnc main4 clr a main4 cpi a, 040h ; check valr to max. value jrc main3 ldi a, 03fh ; limit valr to its max. value main3 addi a, 040h ld x, a ; load valr@ in x register main2 ld a, (x) ; calculate current compensation data ; ****** torque limitation task ****** jp mainc ; enable this instruction to stop ; torque limitation cp a, adccou ; jrc mainc ld a, adccou ; limit to the max. requested torque ; ******** speed control task ******** mainc ld index,a ; ldi index,00h ; enable this instruction to inhibit ; current compensation main5a ld a, adcvit ; load speed reference sub a, index ; substrate current comp. to speed ref. jrnc main5 ldi a, tdmin ; limit trig. delay time to min. value ; ***** phase angle control task ***** main5 ld tcr,a ; load timer for triac triggering delay ldi tscr,01111100b ; start timer with interrupt & psc = 16 set 7,flit ; b7 <= 1, b7 indicates timer operation ; ****** delay time control ****** cpi a, tdtim ; if tdelay > tdmin, jrc mainm ; then read references before triggering sensorless motor drive with the st62 mcu + triac 18/22
; ****** speed reference & torque limit task ***** jrr 3,flit,atfin ; read potentiometer when vac is > 0 call vit ; read speed ref. & torque lim. atfin jrs 7,flit,atfin ; wait end of timer operation jp main mainm jrs 7,flit,mainm ; wait end of timer operation jrr 3,flit,fin ; read potentiometer when vac is > 0 call vit ; read speed ref. & torque lim. fin jp main ;************************************************************************* ;* program subroutines * ;************************************************************************* ;*************** current measurement subroutine ************************* adc ldi prb, 0eh ; pb1 in a/d input ldi prbd, 00h ldi prbo, 03h ldi adcr, 30h ; start conversion adc1 jrr 6,adcr,adc1 ; wait end of conversion ld a, adr ; a <= adr com a ; complement a/d result to obtain ; current measure referred to vss adc2 ld valr, a ; update motor current measure in valr ret ;******** speed reference & torque limitation measure subroutine ********* ; ****** speed reference measurement task ******* vit ldi prb, 0eh ; pb2 input connected on a/d converter ldi prbd, 00h ldi prbo, 05h ldi adcr, 30h ; a/d conversion start vitadc jrr 6,adcr,vitadc ; wait at end of conversion ld a, adr ld adcvit, a ldi x, adcvit ldi adcvit1,00h call div4 ldi drwr,vitt.w ; convert measured value in ld a, adcvit1 ; triac triggering delay time addi a, 40h ld x, a ld a, (x) ld adcvit,a ; ****** torque reference measurement task ****** cou ldi prb, 0eh ; pb3 input connected on a/d converter ldi prbd, 00h ldi prbo, 09h ldi adcr, 30h ; a/d conversion start cou1 jrr 6,adcr, cou1 ; wait at end of conversion ld a, adr ld adccou, a ldi x, adccou ldi adccou1,00h call div4 sensorless motor drive with the st62 mcu + triac 19/22
ldi drwr,couple.w ; convert measured value in ld a, adccou1 ; triac triggering delay time addi a, 40h ld x, a ld a, (x) ld adccou,a fvit ldi prb, 0eh ldi prbo, 03h ret ;****************** division by 4 subroutine ***************************** div4 ldi loop, 06h div42 ld a,(x) sla a ld (x),a inc x ld a,(x) rlc a ld (x),a dec loop jrz div41 dec x jp div42 div41 ret ;************* register context saving subroutine ************************ sr ld da, a ; a-->da ld a, x ; x-->a ld dx, a ; a-->dx ld a, y ; y-->a ld dy, a ; a-->dy ret ;************* register context restoring subroutine ********************* rstr ld a,dx ; dx-->a ld x,a ; a-->x ld a,dy ; dy-->a ld y,a ; a-->y ld a,da ; da-->a ret ;************* register context saving subroutine ************************ srb0 ld dab,a ; a-->dab ld a, x ; x-->a ld dxb,a ; a-->dx ld a, y ; y-->a ld dyb,a ; a-->dy ret ;************* register context restoring subroutine ********************* rstrb0 ld a,dxb ; dx-->a ld x,a ; a-->x ld a,dyb ; dy-->a ld y,a ; a-->y ld a,dab ; dab-->a ret ;****************** timer interrupt subroutine *************************** sensorless motor drive with the st62 mcu + triac 20/22
itim ldi tscr,00h ; stop the timer call sr ; save context jrs 2,flit,itim1 ; 2nd interrupt ? jrs 4,flit,itim2 ; 3rd interrupt ? set 2, flit ; 1st interrupt ; b2 <= 1 ldi pra, 00h ; trigger the triac with boost nop ; ldi pra, 01h ; reduce gate current and wait at triac ; latching ( pa0 turns off ) ldi tcr, tgate ; load timer triac triggering ldi tscr, 01111100b ; start timer & psc = 16 jp ftim itim1 res 2, flit ; 2nd interrupt ldi pra, 07h ; stop the triac gate pulse : pa to vdd set 4, flit ; prepare 3rd interrupt ldi drwr, rtmes.w ; current measure delay time ld a, valr subi a, ofset1 ; a <= valr - ofset1 jrnc itim3 clr a itim3 cpi a, 040h jrc itim4 ldi a, 03fh itim4 addi a, 040h ld x, a ld a, (x) ld tcr, a ; load timer with maesure. delay time ldi tscr,01111100b ; start timer & psc = 16 jp ftim itim2 res 4, flit ; 3rd interrupt jrs 3,flit,ftim1 ; sense motor current when vac < 0 ldi pra, 0fh ; pointer for current measure test call adc ; if negative, measure shunt voltage ldi pra, 07h ; end of pointer ( optional ) ftim1 res 7, flit ; end of timer operation ftim call rstr ; restore context reti ;****************** 0 crossing interrupt subroutine ********************** ipb ldi wdr, 0feh ; watchdog control call srb0 ; save context jrr 3,flit,ipb1 ; test on line half cycle polarity res 3, flit ; negative half cycle operation ldi ior, 30h ; prepare rising edge interrupt jp ipb2 ipb1 set 3, flit ; positive half cycle operation ldi ior, 10h ; prepare falling edge interrupt ipb2 set 0, flit ; 0 crossing indicator validation call rstrb0 ; restore context reti ;********************* unused interrupt addresses ************************ sensorless motor drive with the st62 mcu + triac 21/22
iadc reti ipa reti imni reti ;*********************** interrupt vectors ******************************* .org 0ff0h jp iadc ; adc jp itim ; timer jp ipb ; port b and c jp ipa ; port a .org 0ffch jp imni ; non maskable interrupt vector jp start ; reset interrupt vector ;************************************************************************* .eject .end the software included in this note is for guidance only. sgs-thomson shall not be held liable for any direct, indirect or consequential damages with respect to any claims arising from use of the software. information furnished is believed to be accurate and reliable. however, sgs-thomson microelectronics assumes no responsability for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of sgs-thomson microelectronics. specifications mentioned in this publication are subject to change without notice. this publication supersedes and replaces all information previously supplied. sgs-thomson microelectronics products are not authorized for use as critical components in life support devices or systems without the express written approval of sgs-thomson microelectronics. ? 1994 sgs-thomson microelectronics - all rights reserved purchase of i 2 c components by sgs-thomson microelectronics, conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system, is granted provided that the system conforms to the i 2 c standard specifications as defined by philips. sgs-thomson microelectronics group of companies australia - brazil - france - germany - hong kong - italy - japan - korea - malaysia - malta - morocco the netherlands - singapore - spain - sweden - switzerland - taiwan - thailand - united kingdom - sensorless motor drive with the st62 mcu + triac 22/22


▲Up To Search▲   

 
Price & Availability of AN416

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X