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

Models: DRM079

1 34
Download 34 pages 61.79 Kb
Page 28
Image 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

Page 28
Image 28
Freescale Semiconductor DRM079 manual Kbipe, #MTIMBUSCLKMTIMDIV256, Mtimclk, #255, Mtimmod, HALL, Kbies