Maker Pro
Maker Pro

Zero flag (PIC)

D

Danny

Jan 1, 1970
0
Hi

If i want to check whether there is no input (assuming it is setup as an
input) PORTA is blank (ie no buttons are pressed) would the following work:

(based on assembly instructions but in pseudo code)

BEGINNING: Load PORTA into the working register
If zeroflag in status register is clear skip next instruction
GOTO BEGINNING
Continue..

or would i have to use a logical operation to influence the status register?
ie:

BEGINNING: Load PORTA into the working register
AND the working register with FF(hexadecimal)
If zeroflag in status register is clear skip next instruction
GOTO BEGINNING
Continue..

Dan
 
N

News Group

Jan 1, 1970
0
You can move porta to porta with

movf PORTA,F

and this will set the Zero flag (without affecting W). However, it also
writes back to port a and can therefore change any pins that are set to
output.

HTH

Mike.
P.S. I assume a button press sets the input to logic high.
 
N

News Group

Jan 1, 1970
0
Dosn't matter, The instruction reads porta and writes back to porta. The
question was "how can I set the zero flag dependant on port a". The question
only makes sence if a key press takes the input high, which is what I stated
in the P.S.

Mike.
 
Top