movlw 0x0C ;custom data code
xorwf DataCode, W
btfss STATUS, Z
goto doNotPowerButton
goto toggleSystemPower
doNotThisDevice:
doNotPowerButton:
call pDelay250ms
call pDelay250ms
goto clearVariables
;================================================
call pDelay250ms
;================================================
toggleSystemPower:
btfsc PowerState, Bit7
goto turnPowerOff
;------------------------------------------------
turnPowerOn:
movlw cPowerOn
movwf PowerState
PowerUpSystem
goto afterToggleSystemPower
;------------------------------------------------
turnPowerOff:
call pDelay250ms
call pDelay250ms
call pDelay250ms
call pDelay250ms
call pDelay250ms
call pDelay250ms
call pDelay250ms
call pDelay250ms
movlw cPowerOff
movwf PowerState
PowerDownSystem
nop
afterToggleSystemPower:
call pDelay250ms
clearVariables:
clrf AddrCode
clrf AddrCodeNot
clrf DataCode
clrf DataCodeNot
goto doIrCheck
end