I'm using a PIC 16F1876. In a subroutinre I have the following code.
If T_Sel = 1 then
AnemNS:
BTFSC PORTA,0; Rec_1
Goto Anem1b
A_Cnt = A_Cnt + 1; # of times Inst. Cycles repeated
BTFSC STATUS, C; Check fo Carry Bit
Goto Anem1B
Goto AnemNS
End If
'
If T_Sel = 2 then
AnemSN:
BTFSC PORTA,1; Rec_2
Goto Anem1b
A_Cnt = A_Cnt + 1
BTFSC STATUS, C
Goto Anem1B
Goto AnemSN
End If
'
If T_Sel = 3 then
AnemEW:
BTFSC PORTB,1; Rec_3
Goto Anem1b
A_Cnt = A_Cnt + 1
BTFSC STATUS, C
Goto Anem1B
Goto AnemEW
End If
'
If T_Sel = 4 then
AnemWE:
BTFSC PORTB,2; Rec_4
Goto Anem1b
A_Cnt = A_Cnt + 1
'BTFSC STATUS, C
'Goto Anem1B
Goto AnemWE
End If
'
Anem1b:
The above code works. If I remove the comments marks in the T_Sel = 4 section from:
BTFSC STATUS, C
Goto Anem1B
GCB still compiles the code with no errors and I can download it to the PIC BUT only the code under the T_Sel = 1 section runs before the program freezes.
Does anyone know how to fix this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using a PIC 16F1876. In a subroutinre I have the following code.
If T_Sel = 1 then
AnemNS:
BTFSC PORTA,0; Rec_1
Goto Anem1b
A_Cnt = A_Cnt + 1; # of times Inst. Cycles repeated
BTFSC STATUS, C; Check fo Carry Bit
Goto Anem1B
Goto AnemNS
End If
'
If T_Sel = 2 then
AnemSN:
BTFSC PORTA,1; Rec_2
Goto Anem1b
A_Cnt = A_Cnt + 1
BTFSC STATUS, C
Goto Anem1B
Goto AnemSN
End If
'
If T_Sel = 3 then
AnemEW:
BTFSC PORTB,1; Rec_3
Goto Anem1b
A_Cnt = A_Cnt + 1
BTFSC STATUS, C
Goto Anem1B
Goto AnemEW
End If
'
If T_Sel = 4 then
AnemWE:
BTFSC PORTB,2; Rec_4
Goto Anem1b
A_Cnt = A_Cnt + 1
'BTFSC STATUS, C
'Goto Anem1B
Goto AnemWE
End If
'
Anem1b:
The above code works. If I remove the comments marks in the T_Sel = 4 section from:
BTFSC STATUS, C
Goto Anem1B
GCB still compiles the code with no errors and I can download it to the PIC BUT only the code under the T_Sel = 1 section runs before the program freezes.
Does anyone know how to fix this?
In the above make that a PIC 16F876.