Looping inside inte...
 
Notifications
Clear all

Looping inside interrupt

2 Posts
1 Users
0 Reactions
7,116 Views
(@shagmwp)
Posts: 5
Active Member Guest
Topic starter
 

In the manual it says that interrupts must not be called directly using GOSUB command, does that also mean the GOTO command should not be used to loop inside the interrupt?

Example:

ITR(0,16,0,1,20)
EITR(0)
ITRE

C10
'MAIN LOOP
GOTO10
END

C20
'Interrupt Loop
'DO CODE
IF B(16,0) == 1 'If the I/O pin is still high loop
GOTO20
ENDIF
RETURNI

Is the loop inside C20 okay?

 
Posted : 14/03/2014 7:49 pm
(@csearcy)
Posts: 0
New Member Guest
 

You could do the same with a WHILE LOOP.

Note: You may want to disable the interrupt when you enter the subroutine and re-enable it when you leave to prevent multiple calls.

C20
WHILE B(16,0)==1
'DO CODE
LOOP
RETURNI

 
Posted : 14/03/2014 7:59 pm
Share: