Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:18 21 May 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : How do I disable interrupts ?

Author Message
58kk90
Regular Member

Joined: 14/06/2023
Location: United Kingdom
Posts: 77
Posted: 03:45pm 20 May 2026
Copy link to clipboard 
Print this post

Guys, I am completely baffled here, I have two pins on the Pico connected to two sensors, the pins are defined like this

SetPin GP10,INTH,HallEffectInterrupt1,PULLUP
SetPin GP11,INTH,HallEffectInterrupt2,PULLUP

In the Picomite user manual under the interrupts section, it states

"If you must call a subroutine that is also used by an interrupt you must
disable the interrupt first (you can reinstate it after you have finished with the subroutine)"


So my question is how exactly do I disable the interrupt?
What I want is when the HallEffectInterrupt1 has fired, and i'm dealing with it, setting the flag, doing a bit of code etc, I want to disable the HallEffectInterrupt2 and stop that firing until I have finished dealing with HallEffectInterrupt1.

I have searched the forum, and the manual but cannot find any mention of how to disable and re-enable the interrupt.

Tony
 
terekgabor
Regular Member

Joined: 02/01/2026
Location: Hungary
Posts: 77
Posted: 03:49pm 20 May 2026
Copy link to clipboard 
Print this post

Hello!

Do you mean this:
These interrupts can be disabled by setting ‘period’ to zero  (i.e.  SETTICK 0, 0, 3 will disable tick timer number 3).

G@bor
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1905
Posted: 04:29pm 20 May 2026
Copy link to clipboard 
Print this post

If you have a target sub (mysub in this case) set-up to be triggered by an interrupt

SETPIN pin, INTH, mysub


do

'main code loop
pause 10
loop



sub mysub
'this is called when the pin goes high
.
.
.
'do stuff
.
.
.
end sub



But then you want to directly call the same sub:

SETPIN pin, INTH, mysub


do

'main code loop
pause 10
SETPIN pin, OFF, mysub  'switch off the interrupt
mysub                   'call the sub
SETPIN pin, INTH, mysub 'reinstate the interrupt

loop



sub mysub
'this is called when the pin goes high or directly
.
.
.
'do stuff
.
.
.
end sub

 
58kk90
Regular Member

Joined: 14/06/2023
Location: United Kingdom
Posts: 77
Posted: 04:50pm 20 May 2026
Copy link to clipboard 
Print this post

@terekgabor not quite as it's not a timer interrupt I am dealing with but a hardware interrupt, but thank you.


@PhenixRising thank you that is exactly what I want, I wasn't aware that you can change the pin function 'on the fly' so to speak I assumed they had to be done at the start of your code and once defined they were fixed, I was kind of looking for a disable interrupt HallEffectInterrupt2 type of command I guess that was why I couldn't find anything in the manual.

Tony.
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 488
Posted: 05:32pm 20 May 2026
Copy link to clipboard 
Print this post

58kk90,

you stated:

  Quote  What I want is when the HallEffectInterrupt1 has fired, and i'm dealing with it, setting the flag, doing a bit of code etc, I want to disable the HallEffectInterrupt2 and stop that firing until I have finished dealing with HallEffectInterrupt1.


As you are with both interrupts at the same interrupt level (I/O pin interrupt) you will not be interrupted as long as you do not RETURN from the interrupt SUB-routine. So, everything you need to do on interrupt-level, just do it and then return, keeping it as short as possible. In the manual on page 54/55 you will find the interrupt levels (priorities). Inyour case all interrupts except tick and pin I/O can take effect.
For me there is basically no difference between staying in the interrupt handler or disabling interrupts for your example, at least from your description.

Gerald
Edited 2026-05-21 03:33 by ville56
                                                                 
73 de OE1HGA, Gerald
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026