Freescale Semiconductor DRM079 manual #63, Mtimmod, ACMPSCACF, Acmpsc

Page 19

Temperature Sensor Measurement

Table 3-2. RC Charging Profile Against Timer Count

Time (s)

Voltage across the

ADC Readout

Temperature Sensor (V)

(Timer Count)

 

 

 

 

0

0

0

 

 

 

2

0.10

1

 

 

 

4

0.19

2

 

 

 

6

0.28

3

 

 

 

 

and so on...

 

 

 

 

86

2.82

43

 

 

 

88

2.87

44

 

 

 

90

2.91

45

 

 

 

 

and so on...

 

 

 

 

126

3.52

63

 

 

 

Table 3-2shows the entire dynamic range of the temperature sensor voltage can be covered by about 44 timer counts. For convenience, the timer overflow period is set to 63, which is identical to the size of the paging window ($00C0 to $00FF) in the MC9RS08KA2. The timer value captured can be used directly as an index to the paging window for the target PWM period value lookup.

The code below shows how the timer value is captured using RS08 instructions.

ReadSensor:

#(MTIM_BUS_CLKMTIM_DIV_8), MTIMCLK; Change Timer resolution

mov

mov

#63, MTIMMOD

; OF period

mov

#(mMTIMSC_TRSTmMTIMSC_TOIE), MTIMSC; Reset and Start Timer

mov

#(mACMPSC_ACMEmACMPSC_ACIEACMP_OUTPUT_RAISING), ACMPSC

bset

ACMPSC_ACF, ACMPSC

; Enable ACMP, start RC rise

; Clear ACMP Flag

wait

ACMPSC_ACF, ACMPSC, NoReading

 

brclr

; Capture timer count

mov

MTIMCNT, SensorReading

bset

ACMPSC_ACF, ACMPSC

; Clear ACMP Flag

clr

ACMPSC

; disable ACMP

wait

 

; delay to OF and make the

mov

 

; read process deterministic

#(mMTIMSC_TSTPmMTIMSC_TRST), MTIMSC; mask interrupt and clear

mov

 

; flag

#(MTIM_BUS_CLKMTIM_DIV_256), MTIMCLK; Reset Timer resolution

rts

 

 

NoReading:

#$00, SensorReading

; Smallest Number

mov

clr

ACMPSC

; disable ACMP

mov

#(mMTIMSC_TSTPmMTIMSC_TRST), MTIMSC ; mask interrupt and clear

mov

 

; flag

#(MTIM_BUS_CLKMTIM_DIV_256), MTIMCLK; Reset Timer resolution

rts

 

 

 

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

 

 

Freescale Semiconductor

19

Image 19
Contents Variable Speed DC Fan Control using the MC9RS08KA2 Page Revision History Variable Speed DC Fan Control using the MC9RS08KA2Freescale Semiconductor Table of Contents Freescale Semiconductor Introduction Chapter IntroductionDC Fan Reference Design Targets Freescale’s New Generation Ultra Low Cost MCUBi-Phase Bldc Motor Diagram Bi-Phase Bldc MotorFreescale Semiconductor Commutation Chapter Motor ControlRotor Position Control Speed Control Commutation WaveformsMotor Startup Fault DetectionFreescale Semiconductor Chapter Implementation Block DiagramHardware Resources Control Loop Firmware Control Loop = V DD⎜ RC⎟ Temperature Sensor MeasurementACMPSCACF, Acmpsc #63, MtimmodAcmpsc Temperature Conversion Temperature Conversion Table Freescale Semiconductor VR1 Freescale Semiconductor Appendix B Program Listing Acmpoutputboth RtidisableMtimtclkfalling Mtimtclkrising#ICSDIV2, ICSC2 #HIGH613NVICSTRM, PageselMAPADDR6NVFTRIM, Icssc MAPADDR6NVICSTRM, Icstrm $3FFA#255, Mtimmod KbiesKbipe #MTIMBUSCLKMTIMDIV256, MtimclkRts Drive coil MAPADDR6SRSMTIMSCTOF, Mtimsc KBISCKBACK, Kbisc#24, Mtimmod KbiscBUZZER, Ptad #6, Mtimmod#30, Mtimmod Page How to Reach Us