Z51F6412
Product Specification
PS030302-0212
P R E L I M I N A R Y
184
Preventative measures (2 cases)
Do not use input bit port for bit operation but for byte operation. Using byte operation instead
of bit operation will not cause any error in using compare jump instructions for input port.
If you use input bit port for compare jump instruction, you have to copy the input port as intern
al parameter or carry bit and then use compare jump instruction.
unsigned char ret_bit_err(void)
{
return
!P00
;
}
MOV R7, #000
JB 080.0, xxx ; it possible to be error
MOV R7, #001
xxx: RET
while(1){
if ((P0&0x01)==0x01)
{ P10=1; }
else { P10=0; }
P11^=1;
}
zzz:
MOV A, 080 ; read as byte
JNB 0E0.0, xxx ; compare
SETB 088.0
SJMP yyy
xxx: CLR 088.0
yyy: MOV C,088.1
CPL C
MOV 088.1,C
SJMP zzz
bit tt;
while(1){
tt=P00;
if (tt==0){ P10=1;}
else { P10=0;}
P11^=1;
}
zzz:
MOV C,080.0 ; input port use internal parameter
MOV 020.0, C ; move
JB 020.0, xxx ; compare
SETB 088.0
SJMP yyy
xxx: CLR 088.0
yyy: MOV C,088.1
CPL C
MOV 088.1,C
SJMP zzz