Key1 movlw But2 ;test for button 1
subwf Cmd_Byte, w
btfss STATUS , Z
goto Key2 ;try next key if not correct code
movf LED_PORT, w ;read PORTB (for LED status)
movwf tmp3 ;and store in temp register
btfss tmp3, LED1 ;and test LED bit for toggling
bsf LED_PORT, LED1 ;turn on LED
btfsc tmp3, LED1
bcf LED_PORT, LED1 ;turn off LED
bcf Flags2, New ;and cancel new flag
call EE_Write ;save the settings
retlw 0x00
Key2 movlw But3 ;test for button 1
subwf Cmd_Byte, w
btfss STATUS , Z
goto Key3 ;try next key if not correct code
movf LED_PORT, w ;read PORTB (for LED status)
movwf tmp3 ;and store in temp register
btfss tmp3, LED2 ;and test LED bit for toggling
bsf LED_PORT, LED2 ;turn on LED
btfsc tmp3, LED2
bcf LED_PORT, LED2 ;turn off LED
bcf Flags2, New ;and cancel new flag
call EE_Write ;save the settings
retlw 0x00