
Mini-ITX Power Solutions Andrei Bulucea
Automotive Solutions Ituner Networks
DC-DC converters - 18 - Automotive Applications
turnon movlw PWR_ON
movwf GPIO
movlw ONDELAY2 ;wait for ONDELAY2
movwf cntr
turnon1 call delay200 ;wait
decfsz cntr,f
goto turnon1
btfss GPIO,0 ;ignition on ?
goto reset ;no: turn off again
; push the system board power button
movlw SW_ON ;push the button
tris GPIO
movlw BUTTON ;wait for BUTTON
movwf cntr
button1 call delay200 ;wait
decfsz cntr,f
goto button1
movlw SW_OFF ;release the button
tris GPIO
; power on state - shut down if ignition off for OFFDELAY
onstate movlw OFFDELAY
movwf cntr
onstate1 call delay200
btfsc GPIO,0 ;ignition on ?
goto onstate ;yes: reset timer
decfsz cntr,f
goto onstate1
; shut down - push the system board power button
movlw SW_ON ;push the button
tris GPIO
movlw BUTTON ;wait for BUTTON
movwf cntr
button2 call delay200 ;wait
decfsz cntr,f
goto button2
movlw SW_OFF ;release the button
tris GPIO
; turn-off state - turn off power after HARDOFF
; go back to restart after ONDELAY
movlw HARDOFF
movwf cntr
movlw ONDELAY
movwf cntr2
shut1 call delay200
btfss GPIO,0 ;ignition on ?
goto shut2 ;:no
decfsz cntr2,f
goto turnon ;go turn-on if ignition on for ONDELAY
goto shut3
shut2 movlw ONDELAY ;ignition off - restart on timer
movwf cntr2
shut3 decfsz cntr,f
goto shut1 ;keep waiting
goto reset ;do hard power off
; 200 ms delay routine
delay200 clrwdt ;tickle the watchdog
movlw .2 ;note count is +1 (decfsz !)
movwf waith
movlw .0
movwf waitm
clrf waitl
del1 decfsz waitl,f ;delay loop - 3 us per iteration
goto del1
decfsz waitm,f
goto del1
decfsz waith,f
goto del1
retlw 0
Comentarios a estos manuales