Ok, the plot thickens.
Rightly or wrongly, I have somewhat bloated interupt handlers (BTW are there any guidelines/rules about how many lines, if statements etc you can lob in there?)
For example, this is what I'm doing when an IOC occurs (this is my interupt handling routine)...
Code:
Switch_Interrupt:
@ INT_DISABLE RABC_INT ; Disable further IOC interrupts
'DEBUG "Interrupt On_status= ", dec on_status, " Mode = ", DEC mode, " AGC Status= ", dec Agc_on_status, 13, 10
IF sw1 = 0 THEN
if on_status = 1 and mode = 1 then goto Switch_off
Mode2_control = 1
Mode3_control = 0
Mode4_control = 1
on_status = 1
MODE = 1
high GREEN_LED
low RED_LED
'IF debug_out = 1 then DEBUG "Sw1 On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10
goto interrupt_end
endif
IF sw2 = 0 THEN
pause 150
if sw3 = 0 then
Mode2_control = 1
Mode3_control = 1
Mode4_control = 0
on_status = 1
HIGH GREEN_LED
low RED_LED
MODE = 4
'IF debug_out = 1 then DEBUG "Sw3&4 On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10
goto interrupt_end
endif
endif
IF sw2 = 0 THEN
if on_status = 1 and mode = 2 then goto Switch_off
Mode2_control = 0 '
Mode3_control = 0
Mode4_control = 1
on_status = 1
MODE = 2
high GREEN_LED
high RED_LED
'IF debug_out = 1 then DEBUG "Sw2 On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10
goto interrupt_end
endif
IF sw3 = 0 THEN
if on_status = 1 and mode = 3 then goto Switch_off
Mode2_control = 1
Mode3_control = 1
Mode4_control = 1
on_status = 1
MODE = 3
low GREEN_LED
high RED_LED
'IF debug_out = 1 then DEBUG "Sw3 On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10
goto interrupt_end
endif
goto interrupt_end
Switch_off:
on_status = 0
mode = 0
low Green_LED
low Red_led
Mode2_control = 1 '
Mode3_control = 1
pwm_width = 0
'IF debug_out = 1 then DEBUG "Switch_Off On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10
interrupt_End:
IOC_FLAG = 0
@ INT_ENABLE RABC_INT
'IF debug_out = 1 then DEBUG "Int_End On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10
@ INT_RETURN
'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
IF MODE = 4 THEN
TOGGLE Green_LED
TOGGLE RED_LED
ENDIF
@ INT_RETURN
END
If I comment out all the lines above starting "if debug_out = 1", my program then compiles fine! If I uncomment them I get 53 compilation erros (along the lines of what I posted earlier). But get this, while they're uncommented - which would normally give the errors - if in the main body of my program (not the interupt handlers), I then reduce the number of 'if' statements, like thus...
(ignore the actual if/then statements - they're changed here to be easier on the eye & to get my point across)
Code:
IF Signal_In > target + 3 THEN goto a
IF Signal_In > target + 2 THEN goto b
IF Signal_In > target + 1 THEN goto c
IF Signal_In < target - 3 THEN goto d
IF Signal_In < target - 2 THEN goto e
'IF Signal_In < target - 1 THEN goto f ' program compiles even with my bloaty interupt if I comment out any one of these lines
pause 20
GOTO START
a:
b:
c:
d:
e:
' f: ' program compiles even with my bloaty interupt if I comment out any one of these lines
So it seems to be a either combination of the amount of code I've lobbed into the interupt handler &/or the number of if statements I have in my main progam body.
(before pouring scorn on the way I've approached this
...remember, I'm just a n00b - I work within the confines of my limited programming knowledge until a particular problem/situation forces me to learn something new!!)
Bookmarks