PDA

View Full Version : Help...Hardware Interrupt



tohu thomson
- 30th January 2008, 11:28
hello
I make a simple program with hardware interrupt on portb.5. The program works well, but the return from the interrupt takes 67 seconds !! why?
How can I reduce that time to return immediately from the interrupt to main program ??

this is my code:

DEVICE 16F628a
ON_INTERRUPT GOTO Flash
CONFIG INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, BODEN_OFF, MCLRE_OFF,lvp_off

SYMBOL RBIE = INTCON.3
SYMBOL RBIF = INTCON.0
SYMBOL GIE = INTCON.7

SYMBOL Output0 = PORTb.7 ;13
SYMBOL Output1 = PORTb.4 ;10
SYMBOL Output2 = PORTa.1 ;18
SYMBOL Output3 = PORTb.6 ;12

SYMBOL LED = PORTa.0 ;17
SYMBOL prog_sw = PORTb.5 ;11

GOTO Over_interrupt


Flash:


OUTPUT0=1
DELAYMS 2000
OUTPUT0=0
RBIF = 0
CONTEXT RESTORE

Over_interrupt:
TRISB = 0
TRISA=0
INPUT PROG_SW
PORTB = 0
PORTA=0

OUTPUT0=1
OUTPUT1=1
OUTPUT2=1
OUTPUT3=1
DELAYMS 1000
OUTPUT0=0
OUTPUT1=0
OUTPUT2=0
OUTPUT3=0

' Initiate the interrupt
GIE = 0
RBIE = 1
GIE = 1
Inf:
LOW LED
DELAYMS 500
HIGH LED
DELAYMS 500
GOTO Inf

END

Thanks

sayzer
- 30th January 2008, 11:56
Seems to be on the wrong forum!

------------------

Acetronics2
- 30th January 2008, 12:29
Hi, Tohu

As Sayzer says ( LOL ! ) this is not the ... wich compiler ? forum ...

But your answer, wether the compiler, is the same, USE ASM INTERRUPTS !!! ...

PbP does better here ... but it's PbP !!!

Good luck

Alain