Re: pic problem
If you need to check the value of a file register, do this:
movf File_reg, F ; does nothing but set Z flag, if File_reg=0
btfsc STATUS, Z ;
goto F_eq_zero ;
If you want to compare the File_reg with a certain value, do this:
movf File_reg,W ;get value in W
sublw VALUE ;subtract W from value to compare with
btfsc STATUS, Z ; jump if result zero, i.e. File_reg=VALUE
goto File_eq_zero ;
btfss STATUS, C ;check carry bit, if set, result was POSITIVE, so File_reg<VALUE
goto File_higher ;if C clear, result was negative, so File_reg>VALUE
goto File_lower ;C was set, so File_reg<VALUE
Note that sublw does two's complement operations, that is why C is set for positive results. But it subtracts W from VALUE.
If the quantity you need to compare is in W already, then you do not need the movf File_reg instruction, but after you do the jumps you must restore W by adding VALUE. That has to be done at each of those addresses: File_eq_zero, File_lower, File_higher.
Like this
File_lower: addlw VALUE ; restore W
...
File_higher: addlw VALUE ; restore W
...
File_eq_zero: addlw VALUE ; restore W
...
A little more complicated than the CJNE.