0
\$\begingroup\$

How do I write an ISR greater than 8 bytes which is triggered by INT0?

\$\endgroup\$
  • 3
    \$\begingroup\$ You place a jump instruction at the address of the interrupt handler, which then allows the actual handler code to be placed anywhere in memory where there's enough room for it. \$\endgroup\$ – Dave Tweed Oct 5 '14 at 15:02
  • \$\begingroup\$ ORG 0003H ; LJMP START; RETI like this? \$\endgroup\$ – user258699 Oct 5 '14 at 15:14
  • 2
    \$\begingroup\$ What is that RETI for at that place? There is no return from a jump, so the RETI must be at the end of the code that you jump to. \$\endgroup\$ – Wouter van Ooijen Oct 5 '14 at 15:21
2
\$\begingroup\$

Your code jumps to the ISR which ends in a RETI:

    org 0003H
    jmp isr

    ; ...

isr:
    ; any instruction you need
    reti

If you program in C, this will be handled for you automatically. For example, Keil-C51 places ISRs right at the start address if there is enough room, or jumps to it if not.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.