| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
AN2149 Compressor Induction Motor Stall Rotation Detection using
Top Searches for this datasheetOrder this document AN2149/D AN2149 Compressor Induction Motor Stall Rotation Detection using Microcontrollers William Mackay Motorola Microcontroller Division East Kilbride, Scotland. Introduction Domestic refrigeration appliances commonly single-phase induction motors drive compressor pump. compressor used provide maintain required refrigerant pressure allow fridge compartment function within desired pre-selected temperature range. This application note provides method detecting motor stall condition means monitoring rotation during normal conditions. Motor stall/rotation detection based phase difference measurement between start windings motor. This achieved very conveniently using timer input capture features available Motorola HC908KX8 cost high performance `flash' Microcontroller. There necessity provide some form protection from conditions that cause motor windings sustain thermal damage during start-up. This caused motor stall condition. motor stalled, overheating will occur fairly rapidly cause permanent damage Motor windings. example, mechanical failure compressor pump impair rotation motor result stall condition. Motorola, Inc., 2001 Application Note Compressor motors today's refrigeration appliances thermally protected bi-metallic contact that embedded motor windings. This contact series with line supply motor will open remove power motor when overheating occurs, example, motor stall condition. This method suitable only providing thermal protection motor windings. From power-on this achieved more efficiently economically using Motorola Microcontroller Embedded Solution. Microcontroller solution additional advantage providing method stall detection detecting rotation motor start-up monitoring rotation during normal conditions. Line Zero Cross Detection Hardware Implementing efficient motor start procedure achieved using Triac relay control technique. This involves firstly applying power winding motor using Relay. Triac connected series with start winding fired close zero crossing points line voltage specific period time start motor. After this period Triac turned motor continues run. start winding provides initial starting torque and, after motor started, further duty until motor powered down re-started. schematic diagram hardware required follows. AN2149 Line Zero Cross Detection Hardware Motorola Application Note Detection Schematic Detection Schematic RELA Micro 220k 220k Micro Input Capture Motor Triac Drive Circuitr 110ohm From Winding Winding Zero Cross Detection Start Winding 220k 220k Micro Input Capture Winding Zero Cross Detection When running, continuous rotational motion motor magnetic field induces voltage redundant start winding. During normal running conditions there measurable phase difference between start windings. This illustrated following diagrams. AN2149 Motorola Line Zero Cross Detection Hardware Application Note 2.1.1 Start Winding Before Rotation Winding Start Winding above stalled condition windings phase. 2.1.2 Phase Difference During Condition Winding Start Winding Normal conditions yields phase difference between start windings. AN2149 Line Zero Cross Detection Hardware Motorola Application Note Phase Difference Measurement Process Phase Difference Measurement Process phase difference between start windings approximately 1mS. presence this difference indication motor rotation. When motor rotating, there difference phase between start windings. This change behavior provides measurement source Microcontroller. following diagram illustrates measurement process. Winding Zero Cross Start Zero Cross Start Winding Phase Shift Phase Phase `phase shift' actual phase difference between start windings. `phase min' `phase max' define acceptable tolerance band detection start zero cross point from zero cross reference point. Line Signal Conditioning zero cross detect circuit conditions above waveforms into usable digital signals which result series pulses switched between half period line frequency, this case 10mS. digital signals derived from zero crossing points AN2149 Motorola Line Zero Cross Detection Hardware Application Note start windings input Microcontroller input capture pins. sample digital waveforms applied input capture pins follows. 2.3.1 Input Microcontroller Before Rotation Winding Start Winding 2.3.2 Input Microcontroller During Condition Winding Start Winding This digital representation phase difference between start windings during normal running conditions. AN2149 Line Zero Cross Detection Hardware Motorola Application Note Detection Algorithm Detection Algorithm algorithm will monitor continuous presence pulses input capture pins derived from start windings. pulses detected appropriate sequence time frame, motor considered being stalled condition appropriate action taken, example, removing power from motor raising audible alarm. Alternatively, input capture used monitor winding start winding monitored using input port. This would require additional code poll port timely sense. method described here takes advantage both input captures. Consecutive Detection detection operation follows. Every time zero crossing point detected winding, expected that zero cross point should detected start winding approximately later. timing between start zero cross points measured with appropriate tolerance band included measurement. algorithm arranged zero cross points time reference. Each time `run' zero cross point detected, `run' interrupt service routine entered time this event latched. Approximately later start winding zero cross point will detected `start' interrupt service routine will entered. time this event will latched also. reasonable expect that noise influence quality detected signal from either start winding, compensate this possibility, algorithm will expect that zero cross detections should consecutive. example `run' winding zero cross point detected corresponding `start' zero cross point detected within expected time, this event will identified error. predefined number non-consecutive zero cross errors will tolerated before power-down alarm action invoked. AN2149 Motorola Line Zero Cross Detection Hardware Application Note Flowcharts following flowcharts demonstrate algorithm which implements stall/rotation detection induction motor refrigeration compressor. algorithm implemented from main routine that controls detection through interrupt service routines, also controls power motor. includes facility raise audible alarm when motor rotation expected state. AN2149 Flowcharts Motorola Application Note Consecutive Detection main Stall Detect Main Routine Initialise device application parameters motor power 'on' stall detect requested stall detect disable stall detect enable motor stalled motor power 'off' alarm 'on' AN2149 Motorola Flowcharts Application Note Motor `On' Routine call from main power-up motor motor status 'on' return AN2149 Flowcharts Motorola Application Note Consecutive Detection Enable Stall Detect Routine call from main enable stall detect input capture return Disable Stall Detect Routine call from main disable stall detect input capture return AN2149 Motorola Flowcharts Application Note Motor `Off' Routine call from main power-down motor motor status 'off' return Alarm `On' Routine call from main alarm return AN2149 Flowcharts Motorola Application Note Consecutive Detection icap interrupt Line Zero Cross Detect Input Capture Interrupt Routine start phase time 40mS start phase expired fire triac increment 'start phase' count read zero cross detect time disable zero cross detect reset start phase reset input capture flag return AN2149 Motorola Flowcharts Application Note increment 'phase shift valid' count Start Winding Zero Cross Detect Interrupt Routine motor stall detect interrupt phase shift valid count start zero cross count read start zero cross time from timer reset 'consecutive error' count increment start zero cross count increment consecutive error count calculate phase shift consecutive phase shift errors phase shift valid clear 'motor stalled' flag reset phase shift valid count reset input capture flag 'motor stalled' flag return AN2149 Flowcharts Motorola Application Note Consecutive Detection Summary There many situations where convenient sometimes necessary have confirmation that motor fact rotating when power applied compressor. conventional arrangement motor protected from thermal damage bi-metallic contact. Microcontroller manage this situation, decisions taken software based zero cross detection events start windings. this motor protected from taking excessive power when stalled condition, therefore excessive winding temperature situations prevented from power-on. Additional thermal protection also included connecting sensor analogue digital converter continuously monitor motor temperature. applications that demand increased operational safety, knowing that motor rotating used comparative reference parameter closed loop system integrity, safety measurements, logic state confirmation checks. example, pressurised system, motor rotation confirmed expected that some time later system should have achieved specific pressure value. This measured using pressure sensor analogue digital converter inputs Microcontroller. Flow measurement achieved using simple in-line switch connected device input/output ports. these situations Microcontroller confirm motor rotation compare with feedback parameters measured within software control loop. Single-phase induction motors widely used ratings less, rarely greater than This power range motors meet through higher starting torque demands which required many household industrial appliances, such fans, which have starting torque higher starting torque demands pumps, conditioning units, refrigeration compressors. well being cost-effective solution, adaptability programmability Microcontroller make significant impact control, safety efficiency these appliances. AN2149 Motorola Summary Application Note Code During initial start-up phase, probability stall condition higher. This typically caused mechanical failure where motor unable start obstruction, electrical failure when motor unable start internal winding damage component failure. However, convenient some systems extend this feature monitor rotation motor time during normal operational cycle application. following code been structured such that functions included application called time from power-on convenient way. main routine used demonstrate implementation code described preceding flowcharts. AN2149 Code Motorola Application Note Main Routine #include "hc08kx8.h" #include "stall.h" generic hc08kx8 header file*/ application header file Main Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note main() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Main routine applies power motor, enables disables stall detection powers motor down based condition flag which controlled stall detect ISR. void main(void) init(); motor_on(); while(1) if(STALL_DETECT_SELECT ENABLED) stall_detect_enable(); if(motor_stalled) motor_off(); alarm_on(); else stall_detect_disable(); port high enable stall detect input capture after start phase expired remove power from motor audible alarm AN2149 Motorola Code Application Note Initialisation Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note init() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Function configures oscillator, device modules initialises application parameters void init(void) config(); init_osc(); init_ports(); init_timer(); init_icap(); init_application(); sets configuration register sets oscillator frequency configure input/output ports initialise timer configure input capture initialises application parameters Configuration Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note config() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Function configures device configuration register void config() CONFIG1= 0x31; disables AN2149 Code Motorola Application Note Oscillator Initialisation Routine Oscillator Initialisation Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note init_osc() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Function sets oscillator frequency void init_osc(void) ICGMR_N0 SET; ICGMR_N1 RESET; ICGMR_N2 SET; ICGMR_N3 SET; ICGMR_N4 SET; ICGMR_N5 RESET; ICGMR_N6 RESET; oscillator frequency multipier 29x307.2khz 8.9Mhz 2.27Mhz freq AN2149 Motorola Code Application Note Initialise Input Output Ports Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note init_ports() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Configures input output ports void init_ports(void) DDRA_BIT0 OUTPUT; DDRA_BIT1 OUTPUT; DDRA_BIT4 INPUT; PTAPUE_BIT4 SET; DDRB_BIT0 INPUT; DDRB_BIT1 INPUT; DDRB_BIT2 INPUT; DDRB_BIT3 DDRB_BIT6 DDRB_BIT5 DDRB_BIT4 OUTPUT; OUTPUT; OUTPUT; OUTPUT; relay buzzer door enable pull-up UPDATE check init temp evaporator temp temp select yellow motor 'on' triac drive power 'on' alarm on-green AN2149 Code Motorola Application Note Timer Initialisation Routine Timer Initialisation Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note init_timer() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Function used configure timer interface module. Sets internal clock pre-scalar timer counter void init_timer(void) RESET; internal clock divide AN2149 Motorola Code Application Note Input Capture Initialisation Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note init_icap() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 This function configures timer channel zero Channel input capture rising falling edge detection void init_icap(void) TSC_TSTOP RESET; TSC0_MS0A RESET; TSC0_MS0B RESET; TSC0_ELS0A SET; TSC0_ELS0B SET; TSC0_CH0IE RESET; TSC1_MS1A TSC1_ELS1A TSC1_ELS1B TSC1_CH1F TSC1_CH1IE RESET; SET; SET; RESET; SET; start timer mode select input capture capture rising falling edge enable interrupts mode select input capture capture rising falling edge clear flag*/ enable interrupts AN2149 Code Motorola Application Note Initialise Application Routine Initialise Application Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note init_application() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Function initialises application parameters void init_application() POWER_STATUS MOTOR_POWER DISABLED; MOTOR_STATUS OFF; TRIAC_DRIVE DISABLED; BUZZER OFF; ALARM_STATUS OFF; ZERO_CROSS_DETECT ENABLED; stall_detect_disable(); ENABLE_INTERRUPTS; motor relay de-energised green triac yellow start motor next zero cross enable stall detect input capture enable interrupts Motor `on' Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note motor_on() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Function powers-on motor void motor_on(void) MOTOR_POWER ENABLED; MOTOR_STATUS motor relay energised AN2149 Motorola Code Application Note 5.10 Stall Detect Enable Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note stall_detect_enable() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Enables stall detection void stall_detect_enable() if(start_phase RESET MOTOR_STALL_DETECT ENABLED; initial motor start phase complete 5.11 Motor `off' Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note motor_off() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Function powers-down motor void motor_off(void) MOTOR_POWER DISABLED; ZERO_CROSS_DETECT DISABLED; MOTOR_STATUS OFF; motor relay de-energised disable icap interrupt motor AN2149 Code Motorola Application Note Alarm `on' Routine 5.12 Alarm `on' Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note alarm_on() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Function invokes alarm status audible alarm void alarm_on(void) ALARM_STATUS BUZZER 5.13 Stall Detect Disable Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note stall_detect_disable() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 Disables stall detection void stall_detect_disable() if(start_phase RESET) initial motor start phase complete MOTOR_STALL_DETECT DISABLED; AN2149 Motorola Code Application Note 5.14 Delay Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note delay() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 This delay triac pulse period void delay(void) unsigned char i,j; for(i=0; i<2; i++) for(j=0; j<1; j++); AN2149 Code Motorola Application Note Input Capture Routine 5.15 Input Capture Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note input_capture() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 This pulses triac when line voltage zero-cross detected, pre-defined motor start period #pragma TRAP_PROC SAVE_REGS void Input_Capture(void) if(start_phase START_TIME TRIAC_DRIVE OFF; delay(); TRIAC_DRIVE ++start_phase; else timer_ch0.count.timer_high TIMER_CH0_HIGH; timer_ch0.count.timer_low TIMER_CH0_LOW; ZERO_CROSS_DETECT DISABLED; MOTOR_STALL_DETECT ENABLED; start_phase RESET; read_register TSC0; ICAP0_FLAG RESET; start phase valid apply pulse triac start phase count line voltage zero cross points start time expired read high byte counter read byte counter disable timer icap interrupt enable timer icap interrupt reset start phase reads status control regr resets CH0F flag AN2149 Motorola Code Application Note 5.16 Stall Detection Routine Copyright Motorola 2000 Function Name Engineer Location Date Created Current Revision Note stall_detect() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 This detects induced voltage motor start winding after initial start phase expired. #pragma TRAP_PROC SAVE_REGS void Stall_Detect(void) timer_ch1.count.timer_high TIMER_CH1_HIGH; read high byte counter timer_ch1.count.timer_low TIMER_CH1_LOW; read byte counter ++start_zero_cross; cumulative count start zero cross points if(timer_ch1.timer_count timer_ch0.timer_count) phase_shift (timer_ch1.timer_count timer_ch0.timer_count); else phase_shift (TIMER_COUNT_MAX timer_ch0.timer_count timer_ch1.timer_count) /*accomodates counter rollover if((timer_ch1.timer_count (timer_ch0.timer_count phase_shift PHASE_MIN))&& (timer_ch1.timer_count (timer_ch0.timer_count phase_shift PHASE_MAX))) checks phase shift tolerance ++phase_shift_valid; cumulative count valid phase shifts each zero cross should have valid phase shift else phase_shift_valid RESET; if(phase_shift_valid start_zero_cross) both counts same ++consecutive_error; cumulative count phase shift errors else consecutive_error RESET; if(consecutive_error PHASE_ERROR_COUNT_MAX) motor_stalled SET; indicates motor stalled else motor_stalled RESET; motor rotating read_register TSC1; reads status control regr ICAP1_FLAG RESET; resets CH1F flag AN2149 Code Motorola Application Note HC08KX8 Generic Header File 5.17 HC08KX8 Generic Header File Copyright Motorola 1999 File Name Author Location Date Created Current Revision Notes HC08KX8.h William Mackay Motorola Microcontroller Division, East Kilbride December 1999 This file maps 68HC908KX8 register defined General Release Specification. #ifndef _HC08KX8_H #define _HC08KX8_H Register Mapping Structures Macros #define REGISTER(a) (*((volatile unsigned char *)(a))) #define BIT(a,b) (((vbitfield *)(a))->bit##b) assumes right left order typedef volatile struct{ volatile unsigned volatile unsigned volatile unsigned volatile unsigned volatile unsigned volatile unsigned volatile unsigned volatile unsigned vbitfield; bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 typedef union struct{ unsigned char timer_high; unsigned char timer_low; count; unsigned short timer_count; }TIMER; TIMER timer_ch0; TIMER timer_ch1; AN2149 Motorola Code Application Note Input Output Ports Port Data register #define #define PTA_BIT0 #define PTA_BIT1 #define PTA_BIT2 #define PTA_BIT3 #define PTA_BIT4 Port Data register #define #define PTB_BIT0 #define PTB_BIT1 #define PTB_BIT2 #define PTB_BIT3 #define PTB_BIT4 #define PTB_BIT5 #define PTB_BIT6 #define PTB_BIT7 REGISTER(0x00) BIT(0x00,0) BIT(0x00,1) BIT(0x00,2) BIT(0x00,3) BIT(0x00,4) REGISTER(0x01) BIT(0x01,0) BIT(0x01,1) BIT(0x01,2) BIT(0x01,3) BIT(0x01,4) BIT(0x01,5) BIT(0x01,6) BIT(0x01,7) Port Data Direction Register #define DDRA REGISTER(0x04) #define DDRA_BIT0 BIT(0x04,0) #define DDRA_BIT1 BIT(0x04,1) #define DDRA_BIT2 BIT(0x04,2) #define DDRA_BIT3 BIT(0x04,3) #define DDRA_BIT4 BIT(0x04,4) Port Input Pull Enable Register #define PTAPUE REGISTER(0x0D) #define PTAPUE_BIT0 BIT(0x0D,0) #define PTAPUE_BIT1 BIT(0x0D,1) #define PTAPUE_BIT2 BIT(0x0D,2) #define PTAPUE_BIT3 BIT(0x0D,3) #define PTAPUE_BIT4 BIT(0x0D,4) Port Data Direction Register #define DDRB REGISTER(0x05) #define DDRB_BIT0 BIT(0x05,0) #define DDRB_BIT1 BIT(0x05,1) #define DDRB_BIT2 BIT(0x05,2) #define DDRB_BIT3 BIT(0x05,3) #define DDRB_BIT4 BIT(0x05,4) #define DDRB_BIT5 BIT(0x05,5) #define DDRB_BIT6 BIT(0x05,6) #define DDRB_BIT7 BIT(0x05,7) AN2149 Code Motorola Application Note HC08KX8 Generic Header File Time Base Register #define #define #define #define #define #define #define #define TBCR TBCR_TBON TBCR_TBIE TBCR_TACK TBCR_TBR0 TBCR_TBR1 TBCR_TBR2 TBCR_TBIF REGISTER(0x1C) BIT(0x1C,1) BIT(0x1C,2) BIT(0x1C,3) BIT(0x1C,4) BIT(0x1C,5) BIT(0x1C,6) BIT(0x1C,7) Configuration Write-Once Registers #define #define CONFIG2 CONFIG1 REGISTER(0x1e) REGISTER(0x1F) Timer Registers Timer Status Control #define #define TSC_PS0 #define TSC_PS1 #define TSC_PS2 #define TSC_TRST #define TSC_TSTOP #define TSC_TOIE #define TSC_TOF Register REGISTER(0x20) BIT(0x20,0) BIT(0x20,1) BIT(0x20,2) BIT(0x20,4) BIT(0x20,5) BIT(0x20,6) BIT(0x20,7) Timer Counter Register #define TCNTH REGISTER(0x21) #define TCNTL REGISTER(0x22) Timer Modulo Register #define TMODH REGISTER(0x23) #define TMODL REGISTER(0x24) Timer Status Control #define TSC0 #define TSC0_CH0MAX #define TSC0_TOV0 #define TSC0_ELS0A #define TSC0_ELS0B #define TSC0_MS0A #define TSC0_MS0B #define TSC0_CH0IE #define TSC0_CH0F Register Channel REGISTER(0x25) BIT(0x25,0) BIT(0x25,1) BIT(0x25,2) BIT(0x25,3) BIT(0x25,4) BIT(0x25,5) BIT(0x25,6) BIT(0x25,7) AN2149 Motorola Code Application Note Timer Channel Register #define TCH0H REGISTER(0x26) #define TCH0L REGISTER(0x27) Timer Status Control #define TSC1 #define TSC1_CH1MAX #define TSC1_TOV1 #define TSC1_ELS1A #define TSC1_ELS1B #define TSC1_MS1A #define TSC1_CH1IE #define TSC1_CH1F Register Channel REGISTER(0x28) BIT(0x28,0) BIT(0x28,1) BIT(0x28,2) BIT(0x28,3) BIT(0x28,4) BIT(0x28,6) BIT(0x28,7) Timer Channel Register #define TCH1H REGISTER(0x29) #define TCH1L REGISTER(0x2a) Registers Control Register #define ICGCR #define ICGCR_ECGS #define ICGCR_ECGON #define ICGCR_ICGS #define ICGCR_ICGON #define ICGCR_CS #define ICGCR_CMON #define ICGCR_CMF #define ICGCR_CMIE REGISTER(0x36) BIT(0x36,0) BIT(0x36,1) BIT(0x36,2) BIT(0x36,3) BIT(0x36,4) BIT(0x36,5) BIT(0x36,6) BIT(0x36,7) Multiply Register #define ICGMR REGISTER(0x37) #define ICGMR_N0 BIT(0x37,0) #define ICGMR_N1 BIT(0x37,1) #define ICGMR_N2 BIT(0x37,2) #define ICGMR_N3 BIT(0x37,3) #define ICGMR_N4 BIT(0x37,4) #define ICGMR_N5 BIT(0x37,5) #define ICGMR_N6 BIT(0x37,6) Trim Register #define ICGTR #define ICGTR_TRIM0 #define ICGTR_TRIM1 #define ICGTR_TRIM2 #define ICGTR_TRIM3 #define ICGTR_TRIM4 #define ICGTR_TRIM5 #define ICGTR_TRIM6 #define ICGTR_TRIM7 REGISTER(0x38) BIT(0x38,0) BIT(0x38,1) BIT(0x38,2) BIT(0x38,3) BIT(0x38,4) BIT(0x38,5) BIT(0x38,6) BIT(0x38,7) Analogue Digital Converter Registers Status Control Register AN2149 Code Motorola Application Note HC08KX8 Generic Header File #define #define #define #define #define #define #define #define #define ADSCR ADSCR_ADCH0 ADSCR_ADCH1 ADSCR_ADCH2 ADSCR_ADCH3 ADSCR_ADCH4 ADSCR_ADCO ADSCR_AIEN ADSCR_COCO REGISTER(0x3c) BIT(0x3c,0) BIT(0x3c,1) BIT(0x3c,2) BIT(0x3c,3) BIT(0x3c,4) BIT(0x3c,5) BIT(0x3c,6) BIT(0x3c,7) A/D-Data Register #define Input #define #define #define #define #define Clock Register ADCLK ADCLK_ADICLK ADCLK_ADIV0 ADCLK_ADIV1 ADCLK_ADIV2 REGISTER(0x3d) REGISTER(0x3e) BIT(0x3e,4) BIT(0x3e,5) BIT(0x3e,6) BIT(0x3e,7) Voltage Inhibit Register Status Register #define LVISR #define LVISR_LVIOUT #endif REGISTER(0xFE0C) BIT(0xFE0C,7) AN2149 Motorola Code Application Note 5.18 Application Header File Copyright Motorola 2000 File Name Engineer Location Date Created Current Revision Notes StallDetect.h William Mackay Motorola Microcontroller Division, East Kilbride March 2000 This file contains application definitions #ifndef #define _STALL_H _STALL_H Constant Definitions #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define RESET ENABLED DISABLED RESET OUTPUT INPUT motor start-up period (40mS) 255x10mS 2.55Sec 0x07 motor stall time period cycles) maximum value timer counter 3408 1136 START_TIME 0x28 STALL_PERIOD 0xFF TIMER_COUNT_MAX 0xFFFF PHASE_MIN 0x0D50 PHASE_MAX 0x0470 PHASE_ERROR_COUNT_MAX 0x06 Input/Output Port Application Definitions #define #define #define #define #define #define #define MOTOR_POWER BUZZER STALL_DETECT_SELECT TRIAC_DRIVE POWER_STATUS MOTOR_STATUS ALARM_STATUS PTA_BIT0 PTA_BIT1 PTA_BIT4 PTB_BIT6 PTB_BIT5 PTB_BIT3 PTB_BIT4 AN2149 Code Motorola Application Note Application Header File Timer #define #define #define #define #define #define #define #define ZERO_CROSS_DETECT ICAP0_FLAG MOTOR_STALL_DETECT ICAP1_FLAG TIMER_CH0_HIGH TIMER_CH0_LOW TIMER_CH1_HIGH TIMER_CH1_LOW TSC0_CH0IE TSC0_CH0F TSC1_CH1IE TSC1_CH1F TCH0H TCH0L TCH1H TCH1L Function Prototypes void void void void void void void void void void void void void void void void void main(void); config(void); init(void); init_ports(void); init_osc(void); init_timer(void); init_icap(void); init_application(void); delay(void); stall_detect_enable(void); stall_detect_disable(); motor_on(void); motor_off(void); power_down(void); alarm_on(void); Input_Capture(void); Stall_Detect(void); Global Variables Zero Page variables #pragma DATA_SEG _DATA_ZEROPAGE unsigned char start_phase; indicates status start time interval unsigned char motor_stalled; indicates motor start status unsigned char stall_time; count permitted stall time unsigned char read_register; dummy read locatin flag clearing unsigned char start_zero_cross; count unsigned phase_shift; time storage unsigned char phase_shift_valid; count unsigned char consecutive_error; count Interrupt Definitions #define #define #endif ENABLE_INTERRUPTS DISABLE_INTERRUPTS cli; sei; AN2149 Motorola Code Application Note Motorola reserves right make changes without further notice products herein. Motorola makes warranty, representation guarantee regarding suitability products particular purpose, does Motorola assume liability arising application product circuit, specifically disclaims liability, including without limitation consequential incidental damages. "Typical" parameters which provided Motorola data sheets and/or specifications vary different applications actual performance vary over time. operating parameters, including "Typicals" must validated each customer application customer's technical experts. Motorola does convey license under patent rights rights others. Motorola products designed, intended, authorized components systems intended surgical implant into body, other applications intended support sustain life, other application which failure Motorola product could create situation where personal injury death occur. Should Buyer purchase Motorola products such unintended unauthorized application, Buyer shall indemnify hold Motorola officers, employees, subsidiaries, affiliates, distributors harmless against claims, costs, damages, expenses, reasonable attorney fees arising directly indirectly, claim personal injury death associated with such unintended unauthorized use, even such claim alleges that Motorola negligent regarding design manufacture part. Motorola registered trademarks Motorola, Inc. Motorola, Inc. Equal Opportunity/Affirmative Action Employer. reach USA/EUROPE: Motorola Literature Distribution; P.O. 5405, Denver, Colorado 80217. 1-303-675-2140 HOME PAGE: http://motorola.com/sps/ JAPAN: Motorola Japan Ltd.; SPS, Technial Information Center, 3-20-1, Minami-Azabu, Minato-ku, Tokyo 106-8573 Japan. 81-3-3440-3569 ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; Silicon Harbour Centre, King Street, Industrial Estate, N.T., Hong Kong. 852-266668334 CUSTOMER FOCUS CENTER: 1-800-521-6274 Motorola, Inc., 2000 AN2149/D Other recent searchesHCF4585B - HCF4585B HCF4585B Datasheet DCR1180F52 - DCR1180F52 DCR1180F52 Datasheet 74LVC162374A - 74LVC162374A 74LVC162374A Datasheet 74LVCH162374A - 74LVCH162374A 74LVCH162374A Datasheet 2N7479U3 - 2N7479U3 2N7479U3 Datasheet 2N7480U3 - 2N7480U3 2N7480U3 Datasheet 2N7481U3 - 2N7481U3 2N7481U3 Datasheet 1945135 - 1945135 1945135 Datasheet 0535200000 - 0535200000 0535200000 Datasheet
Privacy Policy | Disclaimer |