DT instant interrupts with mister_e keypad (16F628A)
I'm new to interrupts and tried DT instant interrupts by Darrel Taylor (thanks Darrel). The blinky works great with the INT_INT.
I want for my program to sleep until woken up by the keypad then go to keypad rutine and flash led as many times as the number pressed.
So I connected keypad's columns to PortB and tried to invoke RBC_INT. Spent few hours double checking everything. No luck.
I had the RBC_INT working with a switch on PortB.6 before and that part worked. Sometimes it will work after I cycle the power but on the first press only (press 5, flashes 5 times), after that it won't till I shut power off again. Sometimes it won't flash the led at all. So when it works, the keypad works as well
Schematic attached.
As always any help appreciated,Code:CMCON = 7 ' Set portA to i/o DEFINE OSC 20 TRISA = %00000 TRISB = %01110000 INCLUDE "DT_INTS-14.bas" ; Base Interrupt System INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts include "modedefs.bas" include "keypad.bas" '======================================================= ' SCAN_ONCE is set to 1 as well as proper keypad settings inside the keypad.bas '======================================================= LED_Grn var PortA.1 ctr var byte ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler RBC_INT, _Scan, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM @ INT_ENABLE RBC_INT ; enable external (INT) interrupts Main: @ sleep goto Main '---[INT - interrupt handler]--------------------------------------------------- Scan: gosub KeypadScan for ctr = 1 to key high led_grn pause 200 low led_grn pause 200 next ctr @ INT_RETURN end
Tom
Bookmarks