raitl
New Member
Having problems with creating a LF program for my bot. I got an example from the net (Linbot) and tried to modify it to work for me. But I'm using 3 sensors instead of 4 so I'm guessing there's something about SENSOR_REG that I have missed or overlooked. Probably wrong bits or something... Any ideas?
Code:
CLRF SENSOR_REG
MOVF L_AD_REG,W
SUBWF VR_AD_REG,W
BTFSC STATUS,C
BSF SENSOR_REG,0
MOVF C_AD_REG,W
SUBWF VR_AD_REG,W
BTFSC STATUS,C
BSF SENSOR_REG,1
MOVF R_AD_REG,W
SUBWF VR_AD_REG,W
BTFSC STATUS,C
BSF SENSOR_REG,2
MOVLW B'00000111'
ANDWF SENSOR_REG,W
ADDWF PCL
GOTO NO_LINE
GOTO LEFT_LINE
GOTO CENTER_LINE
GOTO LEFT_CENTER_LINE
GOTO RIGHT_LINE
GOTO NUL_LINE
GOTO RIGHT_CENTER_LINE
GOTO CENTER_LINE