
Originally Posted by
Scampy
Code:
a=0:a1=55:t=0:x=0
tmr0=55
wail:
goto wail
VAIL:
disable
well this may be one reason... it's looping but doing nothing in-between
I think that is ok, it loops until tmr0 interrupts on overflow.
I have never used ON INTERRUPT, but I see some mistakes probably from cut and paste. ON INTERRUPT should be on a separate line, not in the configurations
OPTION_REG and INTCON need % in front of the binary numbers
enable at the end of the code will never happen, since resume returns us to the main program.
What else?
Code:
@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF &_BODEN_ON & _LVP_OFF & _DATA_CP_OFFON INTERRUPT GoTo VAIL
OPTION_REG=000001
define OSC 4
CMCON=7
INTCON=100000
trisa=0
trisb=0
porta=0
portb=0
SYMBOL SES=PORTA.1
t var word
a1 var byte
a var byte
x var byte
a=0:a1=55:t=0:x=0
tmr0=55
wail:
goto wail
VAIL:
disable
TOGGLE SES
t=t+1
if t=20 and a=0 then
t=0
a1=a1+1
if a1>242 then a=1
endif
if t=125 and a=1 then
t=0
a1=a1+1
if a1>245 then a=2
endif
if t=125 and a=2 then
t=0
a1=a1-1
if a1<242 then a=3
endif
if t=20 and a=3 then
t=0
a1=a1-1
if a1=<55 then a=0
endif
tmr0=a1
INTCON.2=0
resume
enable
end
Bookmarks