Hey guys, can someone please help me out with the following code. As of now it doesn't really do anything, I'm having problems with the code towards the end. For some reason, it doesn't want to subtract 'entered_pass_code' from 'something_clever' correctly. For example when entered passcode is 0x05 and something_clever is 0x01, it should execute the 'return' statement since the result of the subtraction is not zero, but instead it executes the 'match_found' line.
Any ideas??
Any ideas??
Code:
list P=16F84
include P16F84.INC
; Define the direction bit types
f equ 1
w equ 0
; Define the data storage locations
org 0x20
counter res 1
counter_2 res 1
entered_pass_code res 1
num_pass_codes res 1
something_clever res 1
org 0x30
passcodes res 8 ;location of the program
; start defining the program
; no interrupts, so start at 0x0
org 0x00
compare_to_list
call indirect
incf counter_2,f
incf counter,w
subwf num_pass_codes,f
btfss STATUS,Z
goto no_match
goto compare_to_list
indirect
movlw passcodes
addwf counter_2,w
movwf FSR
movf INDF,w
movwf something_clever
movf entered_pass_code,w
subwf something_clever,f
btfss STATUS,Z
goto match_found
return
match_found
nop
no_match
nop
end