I have used DT-Ints for a couple other projects and I finally had a need to use interrupt on change. I thought it would be fairly easy compared to the RX_int and timers, but I seem to be missing something basic as I can not get the interrupts to trigger. Basically I want to monitor Pins B.5 and B.6 on a PIC18F45k22 and if there is ever a change on either pin the to put that output onto PORTA.0. I have added some lines to toggle an LED on A.1 just for a visual check, but it never changes either. I have stripped the code down to the basics and still nothing. I'm assuming there is one register I need to setup but I have tried playing with several with no luck and was under the impression the DT-INTS would take care of the register setting anyway.
Thanks for taking a moment to lookCode:#CONFIG CONFIG FOSC = HSHP CONFIG PLLCFG = ON CONFIG PRICLKEN = ON CONFIG FCMEN = ON CONFIG IESO = OFF CONFIG PWRTEN = ON CONFIG BOREN = ON CONFIG BORV = 250 CONFIG WDTEN = ON CONFIG WDTPS = 512 CONFIG PBADEN = OFF CONFIG MCLRE = EXTMCLR CONFIG STVREN = OFF CONFIG LVP = OFF CONFIG XINST = OFF CONFIG CP0 = ON CONFIG CP1 = ON CONFIG CP2 = ON CONFIG CP3 = ON #ENDCONFIG Clear DEFINE OSC 40 ' Set Xtal Frequency INCLUDE "C:\PBP\DT_INTS-18.bas" ; Base Interrupt System INCLUDE "C:\PBP\ReEnterPBP-18.bas" ; Include if using PBP interrupts 'Set Ports for Outputs/Inputs TRISA = %11111100 TRISC = %10000111 'Set PORTC 0,1,2 to input for switches, 7 for RX TRISD = 0 TRISE = 0 TRISB = %01110011 PORTA.1 = 1 PORTC.4 = 1 ANSELA = 0 ANSELB = 0 ANSELC = 0 ANSELD = 0 ANSELE = 0 ;****************Using Darrel Taylor Interrupts**************************** ;----[High Priority Interrupts]-------------------------------------------- ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler INT1_INT, _IntPORTB5, PBP, yes INT_Handler INT2_INT, _IntPORTB6, PBP, yes endm INT_CREATE ;Creates the High Priority interrupt processor ENDASM @ INT_ENABLE INT1_INT ; enable external (INT) interrupts @ INT_ENABLE INT2_INT ; enable external (INT) interrupts main toggle PORTC.4 pause 500 goto main ;---[INT - interrupt handler]--------------------------------------------------- IntPORTB5: 'cloop PORTA.0 = PORTB.5 toggle PORTA.1 @ INT_RETURN IntPORTB6: '232/485 PORTA.0 = PORTB.6 toggle PORTA.1 @ INT_RETURN
David




Bookmarks