I am writing a program for the PIC16F84A. What i need to do is at the end of my subroutine return to a specific place in the code instead of the line after that which called the subroutine. Can i do this using a GOTO instruction instead of the RETURN instruction? If not, then how?
I am writing a program for the PIC16F84A. What i need to do is at the end of my subroutine return to a specific place in the code instead of the line after that which called the subroutine. Can i do this using a GOTO instruction instead of the RETURN instruction? If not, then how?
If you're calling a subroutine (using call) the return address is pushed onto the stack, so if you don't execute a return (which pops the return address off the stack), the stack will soon overflow.
If you want to do this, don't use a subroutine, and don't use 'call', simply use 'goto' to call the routine, and another 'goto' to return where you want.
One other thing, im using the BTFSC instruction but an not sure if i have to write the bit numbers as 0,1,2,3,4,5,6,7 or 1,2,4,8,16,32,64,128. Which is it please?
You don't in assembler, that's a high level language command. In assembler you need to compare two values, either by subtraction or XOR, then check the status flag values. If you consult the PICList there is a complete section on various methods of doing this.
You don't in assembler, that's a high level language command. In assembler you need to compare two values, either by subtraction or XOR, then check the status flag values. If you consult the PICList there is a complete section on various methods of doing this.
This loads W (the accumulator) with 17 decimal. and does a exclusive or of this value with the value in runseq1. If both are identical then the result of this operation will be 0. So we check the Z(ero) flag in status register and if set, we clear C...
This loads W (the accumulator) with 17 decimal. and does a exclusive or of this value with the value in runseq1. If both are identical then the result of this operation will be 0. So we check the Z(ero) flag in status register and if set, we clear C...