|
iow ioca0 mov a,@0b01100000 iow ioc50 ;set port56,57 input, mov a,@0b00000000 iow ioc60 ;set port6 output start1: mov a,@0b00010100 mov port5,a ;CIN+<CIN- nop nop call compout ;port60 output low mov a,@0x32 call delay ;delay time 5ms ; mov a,@0b00010010 mov port5,a ;CIN+>CIN- nop nop call compout ;port60 output high mov a,@0x64 call delay ;delay time 10ms ; mov a,@0b00001100 mov port5,a ;CIN+<CIN- nop nop call compout ;Port60 output low mov a,@0x96 call delay ;delay time 15ms ; mov a,@0b00001010 mov port5,a nop nop call compout ;port60 output high mov a,@0xC8 call delay ;delay time 20ms jmp start1 ;-------------------------- compout: ;port60 output subprogram jbs status,7 jmp comparator0 comparator1: bs port6,0 jmp $+2 comparator0: bc port6,0 ret ;--------------------- delay: ;delay time subprogram mov dly1,a delay1: mov a,@0x15 ;100us delay time,4MHz,clock=4 mov dly2,a delay2: djz dly2 jmp delay2 djz dly1 jmp delay1 ret ;----------------- eop end
|