Thanks Hank...
I added what you suggested and it is working better... BUT LED0 is still not ON fully when it is on. I looked at it with an O-scope and it is actually a square wave at 2.9 KHz... which makes me think it is constantly re-triggering the interrupt at that 2.9KHz rate (or something??)
Here is my code as it stands...
Code:
#CONFIG
__CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOD_OFF & _IESO_OFF & _FCMEN_OFF
#endconfig
include "ALLDIGITAL.pbp"
INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts
wsave VAR BYTE $70 SYSTEM ' alternate save location for W
DEFINE OSC 4
TrisA = 00000000
TrisB = 00000000
TrisC = 00000000
OPTION_REG.7=0 'Turn On weak pull ups
WPUB.7 = 1
LED0 VAR PORTC.0 'this LED is controlled by the "INT" pin, 16F690=RA2
LED1 var PortC.1 'this LED is controlled by the Main program loop
IOC_FLAG VAR INTCON.0
IOCB.7=1
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RABC_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
IOC_FLAG = 0
@ INT_ENABLE RABC_INT ; enable external (INT) interrupts
Main:
PAUSE 500
Toggle led1
GOTO Main
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
IOC_FLAG = 0
toggle LED0
@ INT_RETURN
Also... i am using a pulse generator that allows me to generate 1,10,100,1000 Hz and that is what I am using to feed RB7 (the source of the INT)
I have looked at the pulse signal feeding the INT and it is clean.
anyone?
PS. when you post code to the forum it seems to not like "%" and deletes some of the bits after the %. There are %'s in my actual code.
Bookmarks