(MOV A, 数字. ;A中有了数字)
JNZ ASDF ;非零转移.
CLR P1.0 ;零,则将P1.0清零.
SJMP QWER ;转到结束.
ASDF:
SETB P1.0 ;否则P1.0置1
QWER:
RET ;结束本程序.
END
var p1.0
if(a==0){
p1.0=""
}
else{
p1.0="1"
}
不知道你是什么语言,但是语法对了 格式可能不对,括号的格式不对!
ORG 0000H
MAIN: JNB P1.0,UP
JNB P1.1,DOWN
SJMP MAIN
UP: MOV R0,#00H
LOP1:MOV A,R0
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P0,A
JNB P1.1,DOWN
LCALL DELAY
INC R0
CJNE R0,#0AH,LOP1
SJMP UP
DOWN: MOV R1,#0AH
LOP2:DEC R1
MOV A,R1
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P0,A
JNB P1.0,UP
LCALL DELAY
CJNE R1,#00H,LOP2
SJMP DOWN
TABLE:DB 0C0H,0F9H,0A4H,0B0H,099H,092H,082H,0F8H,80H,90H
DELAY:MOV R6,#0FFH
LP: MOV R7,#0FFH
LP1:NOP
NOP
DJNZ R7,LP1
DJNZ R6,LP
RET
END