Hi Mike, Ill try and explain the problem another way. If you look at the attached thumbnail(key3.jpg) you can see the watch window. The result 0x20 num1 is 0x81. so far it done as it should have.
SCAN
column1
check1
BTFSC PORTB,4 ; number 1 has been pressed intern pullup is LOW, so skip next instuction
goto check4
MOVLW b'1000 0001 ; = 0x81
goto store
... ;so far so good
...
store
BTFSS 0x20,7 ; contents of work register to be stored at 0x20 IF it is 0x00
GOTO numbers1 .... ok nothing stored here, go to numbers1
BTFSS 0x21,7
GOTO numbers2
BTFSS 0x22,7
GOTO numbers3
BTFSS 0x23,7
GOTO numbers4
goto SCAN
numbers1
movwf num1 ;contents of work register is 1000 0001 ( now in num1)
goto SCAN ; now go and scan for a second keypress.
this is where the problem starts. The internal pullup on RB4 is latched low
so without pressing a key, number one is found again and the value is put in to num2.
the cycle starts again, intern pullup is still low, now the value is put in to num3 and again to num4. what i need to do is reset the intern pullups. after a keypress it stays LOW.
It needs to be HIGH to be able to scan the other keys.
numbers2
movwf num2
goto SCAN
numbers3
movwf num3
goto SCAN
numbers4
movwf num4
goto SCAN
END