stop, end, doze, sleep, nap....which ones disable the interrupt function?

PiX

New Member
Not clear from the Picaxe manuals, does anybody out there have a definitive guide please?
 

westaust55

Moderator
Do you wish to consider hardware interrupts, soft interrupts or both.

For example SLEEP and Doze only responds to a hardware interrupt on a hint pin.
 

AllyCat

Senior Member
Hi,

Yes, it depends which interrupts you're considering and which chips (X2s or M2s, etc.), which may explain why it's not fully documented in the manuals.

This is the type of issue that you might need to test for yourself with a "real" PICaxe, but my guess is that with an M2, only STOP has any possibility of later accepting an interrupt. With an X2, maybe more/most of the commands will still permit an External interrupt, but obviously a Timer interrupt cannot be generated if the clock has stopped (i.e. with SLEEP, and NAP, I believe). But the Command Reference suggests that DOZE does permit hardware interrupts (only X2s of course).

Cheers, Alan.
 

PiX

New Member
I'm working with a software interrupt on a 28X2.
A 28X2 pin expecting a serial input from a remote 18M2 is first driven high by the 18M2 (to force the interrupt) then carries out a SERIN command.
Whilst waiting for the interrupt, and having carried out some other duties, the 28X2 should ideally go into a low power mode, but if not possible it should just do nothing.

grim_reaper: I can't see that END would disable my interrupt as the END command is, I believe, assumed even if you don't state it at the end of a program.
 

hippy

Technical Support
Staff member
A 28X2 pin expecting a serial input from a remote 18M2 is first driven high by the 18M2 (to force the interrupt) then carries out a SERIN command.
Whilst waiting for the interrupt, and having carried out some other duties, the 28X2 should ideally go into a low power mode, but if not possible it should just do nothing.
For the 28X2 the best solution may be to take the serial from the 18M2 into one of the HINTx pins, and have that wake the 28X2 from a permanent sleep ( SLEEP 0 ).

For reliability, and for other non-permanent sleep situations, using the serial in as a 'want to send' interrupt with a 'go ahead and send' signal back to the 18M2 might be recommended.

By far easiest is a separate signal back from the 28X2 to 18M2 but both could be merged onto one signal line using some analogue trickery and spare inputs on both.
 

hippy

Technical Support
Staff member
Untested, but this would be quite an elegant one-wire handshaking scheme. It's probably simpler than some other schemes I and others have suggested in the past ...

Code:
;    18M2        10K               28X2
; .--------.     ___             .------.
; |     TX |>-->|___|---.        |      |
; |        |            }------<>| RX   |
; |    CTS |<-----------'        |      |
; `--------'                     `------'
Code:
Main18M2:
  Low TX
  Do
   Pause 1000
   Gosub SendFrom18M2
   b0 = b0 + 1
  Loop

SendFrom18M2:
  High TX
  Do : Loop Until CTS = 0
  Do : Loop Until CTS = 1
  SerOut TX, T2400, (b0)
  Low TX
  Return
Code:
Main28X2:
  Input RX
  Gosub Interrupt_Enable
  Do
    Sleep 1
  Loop

Interrupt:
  Low RX
  Pause 1
  SerIn RX, T12400, b0

Interrupt_Enable:
  ; ... SETINT on RX going high
  Return
 
Top