Freescale Semiconductor DRM079 manual MAPADDR6SRS, Rts Drive coil

Models: DRM079

1 34
Download 34 pages 61.79 Kb
Page 29
Image 29

 

 

 

Temperature Sensor Measurement

;5) Read Temp Sensor Again

 

; Read Sensor value

bsr

ReadSensor

 

;6) Dead time control

 

 

StartTimer

 

 

;7) During the dead time, update dead time period every 128ms

brclr

SRTISC_RTIF, MAP_ADDR_6(SRTISC), UpdateLater; Update PWM duty cycle

jsr

TableLookup

 

 

UpdateLater:

ActualPeriod

 

 

lda

; Actual-Target

 

sub

TargetPeriod

 

blo

IncPeriod

; if same, Fan speed reach target then exit

beq

WaitAgain

DecPeriod:

DeadTime

; if bigger, decrement DeadTime

lda

 

 

cmp

#MinDeadTime

 

 

blo

WaitAgain

 

 

dec

DeadTime

 

 

bra

WaitAgain

 

 

IncPeriod:

DeadTime

; if smaller, increment DeadTime

lda

 

 

cmp

#MaxDeadTime

 

 

bhs

WaitAgain

 

 

inc

DeadTime

 

 

bra

WaitAgain

 

 

WaitAgain:

 

 

 

;8) Bump COP

MAP_ADDR_6(SRS)

; Bump COP

sta

wait

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

mov

;9) Repeat the control cycle

bra FanControlLoop

;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

;Delay 16ms ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Delay:

mov

#255, MTIMMOD

; OF period

mov

#(mMTIMSC_TRSTmMTIMSC_TOIE), MTIMSC; Reset and Start Timer

wait

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

mov

sta

MAP_ADDR_6(SRS)

; Bump COP

rts

 

 

;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

;Drive coil

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

Freescale Semiconductor

29

Page 29
Image 29
Freescale Semiconductor DRM079 manual MAPADDR6SRS, Rts Drive coil