I tossed the code into MicroCode Studio to get a better look - think I see the problem...
No matter which pin is interrupted, the code jumps back to "Iloop", which is in the middle of the "IF NEWPORTA.5 <> OLDPORTA.5 THEN" test. It loops there until done, blinking the LED as if A.5 were interrupted, no matter which pin actually caused it.Code:IF NEWPORTA.5 <> OLDPORTA.5 THEN ILOOP: I = I + 1 IF I = 5 THEN resume BASE ENDIF LOW LED : PAUSE 1000 : HIGH LED PAUSE 1000 GOTO ILOOP ENDIF IF NEWPORTA.4 <> OLDPORTA.4 THEN I = I + 1 IF I = 4 THEN resume BASE ENDIF LOW LED : PAUSE 1000 : HIGH LED PAUSE 1000 GOTO ILOOP ; <<<<<<<<<< JUMPS BACK TO Iloop ENDIF
Arch
PS - on the erratic triggering, make sure your programmer is actually setting MCLR off, and check for 'floating' inputs.
What value pullup/pulldowns are you using?




Bookmarks