PDA

View Full Version : I'm an idiot and I don't know why! - CCP1_INT



Cobra_Phil
- 22nd January 2010, 22:45
I've been learning about interrupts thanks to the fabulous work of Darrel. I've been able to get INT_INT, RX_INT, and RBC_INT working with no problems. But I can't figure out how to get CCP1_INT working. I've looked at others examples and still I am missing something. Will someone please show me how big of an idiot I really am?
I've tried different configuration with TMR1...starting it, stopping it, leaving it out altogether with no luck.

It doesn't get much easier than this....


'16f628A
DEFINE OSC 20
CMCON = 7
VRCON = 0
TRISB = %00011011
TRISA = %00010000
CCP1CON = %00000101
INCLUDE "DT_INTS-14.bas"
INCLUDE "ReEnterPBP.bas"

clear
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler CCP1_INT, _ToggleLED, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM

@ INT_ENABLE CCP1_INT

Mainloop:
pause 1
goto Mainloop

ToggleLED:
TOGGLE PORTA.0
@ INT_RETURN

Bruce
- 23rd January 2010, 00:21
What is triggering the interrupt on RB3?

Cobra_Phil
- 23rd January 2010, 01:05
pushbutton

Bruce
- 23rd January 2010, 01:24
RB3 CCP1 input is an ST type, so it needs 0.8 * Vdd to meet the logic 1 input threshold.

I can't really tell from your schematic, but it looks like you might have a voltage divider?

Cobra_Phil
- 23rd January 2010, 01:32
5.00v on Pin3

Bruce
- 23rd January 2010, 01:46
Hmm ... should work. I just tested it with the older version of DT_INTS-14 & ReEnterPBP.

Are you using the latest version? I haven't tried the newer rev yet.

Cobra_Phil
- 23rd January 2010, 01:55
I'm using version .93 Beta DT_INTS-14
and version 3.2 ReEnterPBP.

Bruce
- 23rd January 2010, 02:07
Using the same here, but tested it on real hardware with a pull-down holding RB3 low, and
switch pulling it high when pressed. Works 100%.

Is RB3 being held at ground until you press the switch?

Cobra_Phil
- 23rd January 2010, 02:09
Thanks Bruce for the feedback. I'll try to figure out "Whats Up With That"...
Only wasted ~ 9 hours on it.....

Cobra_Phil
- 23rd January 2010, 03:38
Sorry Bruce, didn't see the last portion of your post. I assumed since it worked for you, it was a problem with the simulator. The simulator does show .02v when the button is not pressed and the rest of the inputs work correctly for the other interrupts. I guess I'm going to have to what for the real circuit board to arrive for further testing.

Charles Linquis
- 23rd January 2010, 03:55
I don't see anthing that would pull the inputs low when the switches aren't pushed.

Cobra_Phil
- 23rd January 2010, 04:31
If I change the interrupt to either INT_INT or RBC_INT and move the input to another pin, it works fine. CCP1_INT does not work. It has to be the simulator. I don't have a real 16F628A to test yet. Should have the actual circuit board next week.