脉宽300MS周期600MS方波(由外部计数T0接收脉宽1.5MS周期3MS方波)
采用51单片机芯片下面是汇编语言源代码:
org 0000h
sjmp main
org 000bh
SJMP ZCXC;
MAIN:MOV TMOD,#01010101B
MOV TL0,#9CH;
MOV TH0,#0FFH;
SETB EA
SETB ET0
SETB TR0
SJMP $
ZCXC: CPL P0.4;
MOV TL0,#9CH;
MOV TH0,#0FFH;
RETI
END
org 0000h
sjmp main
org 000bh
SJMP ZCXC;
MAIN:MOV TMOD,#01010101B
MOV TL0,#9CH;
MOV TH0,#0FFH;
SETB EA
SETB ET0
SETB TR0
SJMP $
ZCXC: CPL P0.4
cpl p1.0
MOV TL0,#9CH;
MOV TH0,#0FFH;
reti
end