Welcome, Guest
Messages posted to this category need to be reviewed by the moderator before it gets posted.

TOPIC: Looping inside interrupt

Looping inside interrupt 4 years 7 months ago #1459

  • shagmwp
  • shagmwp's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
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?
The administrator has disabled public write access.

Re: Looping inside interrupt 4 years 7 months ago #1460

  • csearcy
  • csearcy's Avatar
  • OFFLINE
  • Moderator
  • Posts: 459
  • Thank you received: 77
  • Karma: 23
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
Last Edit: 4 years 7 months ago by csearcy.
The administrator has disabled public write access.
Time to create page: 0.240 seconds
Powered by Kunena Forum