ORG 0000H LJMP MAIN ORG 0003H ;INT0中断入口 LJMP XC_INT0 ORG 0030H MAIN: SETB EA SETB EX0 SETB IT0 ST: JnB P3.6,gongya jb p3.6,zhuang SJMP ST gongya:jnb p3.1,shoudong jb p3.1,zidong sjmp gongya
zhuang:jnb p3.1,shoudong1 jb p3.1,zidong1 sjmp zhuang shoudong:lcall delay1 jb p3.1,zidong jb p3.0,k1 jnb p1.0,k2 clr p1.0 lcall delay k2:clr p1.1 setb p1.2 jnb p3.4,ting jnb p3.0,shoudong k1: mov c,p3.3 cpl c mov p1.2,c setb p1.1 jb p3.0,k1 ting:mov c,p3.3 cpl c mov p1.2,c setb p1.1 jnb p3.3,shoudong sjmp ting zidong:lcall delay1 jnb p3.1,shoudong jnb p3.4,k3 jb p3.0,k5 clr p1.0 lcall delay clr p1.1 sjmp zidong k3:setb p1.1 clr p1.2 jnb p3.3,k4 sjmp k3 k4:setb p1.2 setb p1.0 jnb p3.0,zidong sjmp k4 k5: sjmp zidong zidong1:jnb p3.0,qdong jnb p3.3,shang jnb p3.4,xia jnb p3.1,shoudong1 sjmp zidong1 qdong: lcall delay1 jb p3.0,zidong1 clr p1.0 lcall delay mov p1,#11111000b ajmp st xia:nop 为什么在这里添加指令就编译不了?那怕只是一条nop也不通过。 shang:nop shoudong1: lcall delay1 jb p3.1,zidong1 jb p3.0,k20 jnb p1.2,k20 clr p1.0 clr p1.2 lcall delay k20:mov c,p3.0 mov p1.1,c ajmp st
delay: mov r7,50h ;延时子程序 d1: mov r6,#100 d2: mov r5,#100 djnz r5,$ djnz r6,d2 djnz r7,d1 RET delay1: mov r5,#50 ;延时子程序 tt: mov r4,#50 djnz r4,$ djnz r5,tt ret ;===int0外部中断子程序=== XC_INT0:PUSH ACC PUSH PSW CLR IT0 POP PSW POP ACC SETB IT0 RETI
|