PDA

View Full Version : Instant interrupt problem (very strange)



yusoweird
- 31st October 2006, 04:24
I wrote a program that uses Darrel's instant interrupt. It was work perfectly. But, I accidently overwritted it. =( I am so dumb. But anyway, this is the problem I'm having since I rewrote the program...



define OSC 20
define LCD_EREG PORTE
define LCD_EBIT 0
define LCD_DREG PORTD
define LCD_DBIT 4
define LCD_LINES 4

define ADC_BITS 8
define ADC_CLOCK 3
define ADC_SAMPLEUS 100
define BUTTON_PAUSE 300

INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RBC_INT, _ToggleLED2, PBP, yes
INT_Handler INT_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM

pause 1000
TRISB = %11100001
@ INT_ENABLE RBC_INT
@ INT_ENABLE INT_INT ; enable external (INT) interrupts


Lcdout $FE, 1, "HELLOW WORLD"
LCDOUT $FE, $C0

Main:

PAUSE 100

GOTO Main

'---[INT - interrupt handler]---------------------------------------------------

ToggleLED2:
lcdout "no"
pause 100
@ INT_RETURN

ToggleLED1:
lcdout "hi"
pause 100
@ INT_RETURN


The program compiles fine, but when ever I turn on my circuit, RBC_INT is constantly interrupting. All i see is "nonononono..." on my lcd. I cant figure out why it is doing this since I did not change any hardware. Then, I reloaded my old hex file of my previous working program and RBC_INT works fine and does not constantly interrupt. I have no idea what is causing this. Please help me =(

I forgot to say that portb0, portb5-7 are all pulled down and connected to a momentary buttons to 5V.

Darrel Taylor
- 31st October 2006, 12:11
Hi yusoweird,

You need to read PORTB in the interrupt routine to end the mismatch.

<br>

yusoweird
- 31st October 2006, 16:15
AHH! Thanks Darrel!!!! =)