title: Em78p458/9 comparator test program ; ;Description:比較器結(jié)果由Port60輸出,當R3的bit7為1時,輸出high pulse,當R3的 ; ; bit7為0時,輸出low pulse.比較器輸出由port57輸出與port60一樣的 ; ; 波形。 ; ;Company: ELAN MICROELECTRONICS (SZ) LTD.INC ; ;************************************************************************; include "d:/wice/inc/em78_headfile/em78p458.inc" ;include em78p458 head file ;================================================================================= dly1 == 0x30 ;delay register 1 dly2 == 0x31 ;delay register 2 ;---------------------------------------------------------- org 0 jmp start org 0x08 reti start: disi MOV a,@0b00000000 contw ;set cont register bs r9,5 ; register segment MOV a,@0b00000000 iow ioc51 ;set port51,52 funtion bc r9,5 ; MOV a,@0b01100000 ;bit6(CE)=1,enable comparator, ;bit5(coe)=1,set comparator 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 |