PDA

View Full Version : Interrupt



gunayburak
- 26th December 2012, 00:12
Hi

I've got a question about the interrupts
Why in a code , "DISABLE" command is used right before the "LABEL" when pic branches in case of an interrupt . Because in case of an interrupt , pic branches directly to the "LABEL" and runs the codes in the programme block written within the LABEL so it is supposed to SKIP the "DISABLE" command then ....

AND
Why "ENABLE" Command is used right before the "RESUME" command ? Because by "RESUME" the programme is supposed to branch where it was before the interrupt , so PIC can not run "ENABLE" command in this order ...

An example code ... and it works fine ...

Thanks in advance



ON INTERRUPT GOTO INT
OPTION_REG=%0000000
INTCON=%10010000

TRISB=%00000001
TRISA=%00000000

PORTA=0

SYMBOL LED=PORTA.0


START:
PAUSEUS 100
GOTO START

DISABLE
INT:
TOGGLE LED
INTCON.1=0
RESUME
ENABLE
END

mackrackit
- 26th December 2012, 06:19
DISABLE, ENABLE, and RESUME are key words used by the compiler.

As it says in the good book


are more like pseudo-ops in that they give the compiler directions, rather than actually generate code. See ON DEBUG and ON INTERRUPT for more information.