Freescale Semiconductor DRM079 Welding System User Manual


 
Temperature Sensor Measurement
Variable Speed DC Fan Control using the MC9RS08KA2, Rev. 0
Freescale Semiconductor 31
NoReading:
mov #$00, SensorReading ; Smallest Number
clr ACMPSC ; disable ACMP
mov #(mMTIMSC_TSTP|mMTIMSC_TRST), MTIMSC ; mask interrupt and clear flag
mov #(MTIM_BUS_CLK|MTIM_DIV_256), MTIMCLK; Reset Timer resolution
rts
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; 6-bit Table Lookup
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TableLookup:
bset SRTISC_RTIACK, MAP_ADDR_6(SRTISC);5
mov #HIGH_6_13(TableStart), PAGESEL;5 Calculate the PAGE
lda SensorReading ;3
add #$c0 ;2 Reference to paging window
tax ;2
lda ,x ;3
sta TargetPeriod ;2
mov #HIGH_6_13(SOPT), PAGESEL ;5
rts ;3
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; Error Handling
; Stop the motor
; Sound the buzzer (about 520Hz)
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MotorHang:
clr PTAD ; clear PWMp and PWMn
lda MotorRunning ; Check software flag
bne SoundBuzzer ; =1, Motor is running
jmp ResetPosition
SoundBuzzer:
mov #(mMTIMSC_TSTP|mMTIMSC_TRST), MTIMSC; mask interrupt and clear flag
clr KBISC ; mask KBI
lda #255
sta MAP_ADDR_6(SRS) ; Bump COP
Beep: ; a 20% duty cycle loop
bset BUZZER, PTAD ; Drive buzzer
mov #6, MTIMMOD
mov #(mMTIMSC_TRST|mMTIMSC_TOIE), MTIMSC; Reset and Start Timer
wait
mov #(mMTIMSC_TSTP|mMTIMSC_TRST), MTIMSC; mask interrupt and clear flag
sta MAP_ADDR_6(SRS) ; Bump COP
bclr BUZZER, PTAD ; Clear buzzer
mov #24, MTIMMOD
mov #(mMTIMSC_TRST|mMTIMSC_TOIE), MTIMSC; Reset and Start Timer
wait
mov #(mMTIMSC_TSTP|mMTIMSC_TRST), MTIMSC; mask interrupt and clear flag
sta MAP_ADDR_6(SRS) ; Bump COP
dbnza Beep