Freescale Semiconductor DRM079 manual Kbies, Kbipe, #MTIMBUSCLKMTIMDIV256, Mtimclk, #255, Mtimmod

Page 28

Implementation

 

 

sta

KBIES

;HALL rising Edge Trigger

sta

KBIPE

;KBI Enable

;-------------------------------------------------------

 

 

;Config MTIM

 

 

;

 

 

 

;Timer prescalar=256 -> Timer clk = 16kHz

 

;Bus = 4MHz

 

 

;Max OF period = 16.384ms

 

;Timer resolution = 64us

 

;-------------------------------------------------------

mov

#(MTIM_BUS_CLKMTIM_DIV_256), MTIMCLK

 

 

mov

#255, MTIMMOD

 

;-------------------------------------------------------

 

 

;Motor Start Sequence

 

;-------------------------------------------------------

 

 

ResetPosition:

#mPWM1, PTAD

; Lock FAN in reset position

 

mov

Dly1

lda

#30

;

bsr

Delay

; for Delay 0.5s

 

dbnza

Dly1

;

 

clr

PTAD

; de-energize coils

 

bsr

Delay

 

; Drive L2

#mPWM2

; Select L2 Coils

 

ldx

 

bsr

SetPWM

; Drive coil

 

bsr

Delay

; De-energize coils

 

inc

MotorRunning

; otherwise Update Software flag

;-------------------------------------------------------

 

 

;Fan Control Loop

 

;-------------------------------------------------------

 

 

FanControlLoop:

 

;1) Drive L1 coil

; HALL falling edge trigger

 

clr

KBIES

 

ldx

#mPWM1

; Select L1 Coil

 

bsr

SetPWM

; Drive coil

;2) Read Temp Sensor

; Read Sensor value

 

jsr

ReadSensor

;3) Dead time control

; Wait dead time period

 

StartTimer

 

wait

#(mMTIMSC_TSTPmMTIMSC_TRST), MTIMSC; mask interrupt and clear flag

 

mov

;4) Drive L2 coil

; HALL rising edge trigger

 

bset

HALL, KBIES

 

ldx

#mPWM2

; Select L2 Coil

 

bsr

SetPWM

; Drive coil

 

 

Variable Speed DC Fan Control using the MC9RS08KA2, Rev. 0

 

 

 

 

28

 

 

Freescale Semiconductor

Image 28
Contents Variable Speed DC Fan Control using the MC9RS08KA2 Page Variable Speed DC Fan Control using the MC9RS08KA2 Revision HistoryFreescale Semiconductor Table of Contents Freescale Semiconductor Chapter Introduction IntroductionFreescale’s New Generation Ultra Low Cost MCU DC Fan Reference Design TargetsBi-Phase Bldc Motor Bi-Phase Bldc Motor DiagramFreescale Semiconductor Commutation Chapter Motor ControlRotor Position Control Commutation Waveforms Speed ControlFault Detection Motor StartupFreescale Semiconductor Chapter Implementation Block DiagramHardware Resources Control Loop Firmware Control Loop Temperature Sensor Measurement = V DD⎜ RC⎟ACMPSCACF, Acmpsc #63, MtimmodAcmpsc Temperature Conversion Temperature Conversion Table Freescale Semiconductor VR1 Freescale Semiconductor Appendix B Program Listing Rtidisable MtimtclkfallingMtimtclkrising Acmpoutputboth#HIGH613NVICSTRM, Pagesel MAPADDR6NVFTRIM, IcsscMAPADDR6NVICSTRM, Icstrm $3FFA #ICSDIV2, ICSC2Kbies Kbipe#MTIMBUSCLKMTIMDIV256, Mtimclk #255, MtimmodMAPADDR6SRS Rts Drive coilKBISCKBACK, Kbisc MTIMSCTOF, MtimscKbisc BUZZER, Ptad#6, Mtimmod #24, Mtimmod#30, Mtimmod Page How to Reach Us