LIST p=10F222, r=DEC
#include <P10F222.inc>
__CONFIG _IOSCFS_4MHZ & _MCPU_ON & _WDT_ON & _MCLRE_OFF
;********************************************************************************
;Set aside memory locations for variables
COLOR EQU 9
COUNT EQU 10
DELAY EQU 11
DELAY2 EQU 12
FRACTION255 EQU 13
FVRPT6V EQU 14
ON_TIME EQU 15
OPTION_REG EQU 16
SysIFTemp EQU 17
;********************************************************************************
;Vectors
;Start of program memory page 0
ORG 256
BASPROGRAMSTART
;Call initialisation routines
call INITSYS
;Start of the main program
movlw B'00001000'
tris GPIO
movlw 207
movwf OPTION_REG
MAIN
clrf GPIO
;clrf COUNT
bsf GPIO,0
movlw 255
movwf FRACTION255
call DELAY1S
bcf GPIO,0
movlw 255
movwf FRACTION255
call DELAY1S
goto MAIN
BASPROGRAMEND
sleep
goto BASPROGRAMEND
;********************************************************************************
DELAY1S
clrf TMR0
clrf DELAY
movlw 1
subwf FRACTION255,W
btfss STATUS, C
goto SysForLoopEnd5
SysForLoop5
incf DELAY,F
clrf DELAY2
SysForLoop6
incf DELAY2,F
DELAY3
btfss TMR0,7
goto DELAY3
clrf TMR0
movlw 29
subwf DELAY2,W
btfss STATUS, C
goto SysForLoop6
SysForLoopEnd6
movf FRACTION255,W
subwf DELAY,W
btfss STATUS, C
goto SysForLoop5
SysForLoopEnd5
retlw 0
;********************************************************************************
INITSYS
bcf ADCON0,ADON
bcf ADCON0,ANS0
bcf ADCON0,ANS1
movlw B'11001111'
option
clrf GPIO
retlw 0
;********************************************************************************
END