Temperature Sensor Measurement
TargetPeriod ds.b 1
ActualPeriod ds.b 1
DriveTime ds.b 1
SensorReading ds.b 1
MotorRunning ds.b 1
org RAMStart ; variable/data section
org ROMStart
;code section main:
Entry:
;Config ICS
;Device is
;TRIM value are stored in $3FFA:$3FFB
#HIGH_6_13(NV_ICSTRM), PAGESEL |
| |
mov | ; $3FFB | |
mov | MAP_ADDR_6(NV_FTRIM), ICSSC | |
mov | MAP_ADDR_6(NV_ICSTRM), ICSTRM ; $3FFA | |
mov | #ICS_DIV_2, ICSC2 | ; Use 4MHz |
| ||
;Config System |
|
|
#HIGH_6_13(SOPT), PAGESEL | ; Init Page register | |
mov | ||
mov | #(mSOPT_COPTmSOPT_STOPE), MAP_ADDR_6(SOPT) | |
mov |
| ; BKGD disable, COP disabled |
#(mSPMSC1_LVDEmSPMSC1_LVDRE), MAP_ADDR_6(SPMSC1); LVI enable | ||
mov | #(RTI_128MS), MAP_ADDR_6(SRTISC) ; 128ms RTI | |
| ||
; Init RAM |
|
|
#MaxDeadTime, DeadTime |
| |
mov | ; 1000 rpm | |
mov | #232, TargetPeriod | |
mov | #232, ActualPeriod | ; 1000 rpm |
clr | SensorReading |
|
clr | MotorRunning |
|
| ||
; Config GPIO |
|
|
; RC - init L |
|
|
; Buzzer - init L |
| |
; PWMn/PWMp - init L |
| |
PTAD | ; Initial low | |
clr | ||
mov | #(mRCmPWM1mPWM2), PTADD | ; Set Output pins |
| ||
; Config KBI |
|
|
#mHALL |
| |
lda |
| |
| Variable Speed DC Fan Control using the MC9RS08KA2, Rev. 0 | |
|
| |
Freescale Semiconductor | 27 |