PDA

View Full Version : INT0 Zero Interrupts



nemesis
- 26th March 2009, 22:19
Hi All,
I have been banging my head on the wall for weeks. I am not sure what I am missing and I have read over the datasheet many times. Please take a sec to see if you notice anything wrong.

I can't get INT0 to interrupt. The TMR0 interrupt is working great, the led flashes 100ms as desired. If I take pin RA0 and jump to 5V or Ground the interrupt doesnt seem to interrupt. The program should turn on an led if it interrupts.

MCU: PIC18F1330

Thanks Again,
Nemesis

Archangel
- 27th March 2009, 00:44
I gotta ask . . . Why do you put the percent sign before the value of your variables? It seems to me you are telling the Variables, ports and registers to read binary, and I suppose as long as you only use zero and one it will work, but it's confusing as all get out. Why not just use 0 and 1 ?

nemesis
- 27th March 2009, 01:28
Percent madness... I try to make my variable names start with bt for bit, w for word, l for long. The percents really just remind me they are bits. I totally could ditch them. lol maybe I should.

Thanks for looking at the file. I can't figure out what I am missing, really hoping someone finds something.

Archangel
- 27th March 2009, 06:57
The chart sec 9.1 shows INT0 port latch as 1 not zero when INT0 enabled. Other than that I see nothing, but I am really sleepy right now :D Doggone PBP interrupts, it doesn't take much for them not to work . . . You might try commenting out the parts that do work until you hit the right formula . . .

nemesis
- 27th March 2009, 17:09
Anybody pick up anything else? I feel really frustrated with this interrupt. I think I will try pulling out everything but that interrupt as Joe suggested. Just hoping that maybe the order or bit is wrong in one of the registers.

nemesis
- 27th March 2009, 20:54
Thanks for your replies Joe S.

I figured out the problem. My ADCON1 should have been:

ADCON1 = %00011111 ' Set all to digital

Thanks Again,
Nemesis

Gusse
- 27th March 2009, 21:26
After INT0 interrupt you are not clearing INT0IF variable. I don't know does it make difference or not, but add

INT0IF = 0
before last ENDIF in INT0 interrupt section.


Also TMR0 comment is not valid. It should be ON ;)

INTCON = %10110000 ' Global, TMR0 off, INT0 ON

BR,
-Gusse-

nemesis
- 28th March 2009, 01:53
Will do thanks Gussee. Sometimes I am victim of my own cut and paste. Thanks again all.

-Nemesis