
Mini-ITX Power Solutions Andrei Bulucea
Automotive Solutions Ituner Networks
DC-DC converters - 17 - Automotive Applications
ITPS Software
;
; Ituner power sequencer
;
; pd 030611 initial code
LIST p=12C508A ;Target processor
#include "P12C508A.INC" ;Header file for target processor
; GP0 = VSW12 input 1 = ignition turned on
; GP1 = ON output 1 = turn power on
; GP2 = MBON# o.d. 0 = power button pressed
; GP3 = n.c. input
; GP4 = MBON2# o.d. 0 = power button pressed (parallel out,
; makes connector flip-tolerant)
; GP5 = n.c. output 0 = terminate unused pin
; Equates
PWR_OFF equ 0x00 ;power off state
PWR_ON equ 0x02 ;power on state
SW_ON equ 0x09 ;direction for switch on
SW_OFF equ 0x1d ;direction for switch off
ONDELAY equ .15 ;power on delay 3 seconds
ONDELAY2 equ .5 ;wait 1 second until push button
BUTTON equ .2 ;push button for 400 ms
OFFDELAY equ .25 ;shut down 5 s after ignition off
HARDOFF equ .25;&&&225 ;hard off after 45 seconds
; Register variables
cblock 0x10
cntr ;state counter
cntr2 ;state counter
waitl ;delay counter low
waitm ;delay counter mid
waith ;delay counter high
endc
; ORG 0x1FF ; processor reset vector
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
; Reset entry
org 0
reset movwf OSCCAL ;set oscillator calibration
movlw PWR_OFF ;set initial state
movwf GPIO
movlw SW_OFF ;set pin directions
tris GPIO
movlw b'11001101' ;set option register (pg. 17)
;disable wake-up on GP pin change
;disable weak pull-ups
;timer0 internal clock, positive edge
;prescaler -> WDT, 1:32 -> ~0.5s
option
clrwdt ;clear watchdog
; initial state - wait until ignition is on for ONDELAY
initial movlw ONDELAY ;initial power on
movwf cntr
initwait call delay200 ;wait
btfss GPIO,0 ;ignition on ?
goto initial ;no: clear counter
decfsz cntr,f ;initial time-out
goto initwait
; turn power on, wait ONDELAY2
Comentarios a estos manuales