thank you for your reply melone,
but i still very blur by what kind of information is stored inside the P1 and P2 in the below program code....
.equ wflg,00h ;bit flag used to notify main program
.org 0000h
mov sp,#30h ; set stack above bit addreeable area
sjmp over ;jump over INT1 interrupt area
;place /INT1 interrupt routine here
.org 13h
jb int1,noise ;if not low then noise --leave
jbc tr1,stop ;if T1 is running then stop it
setb tr1 ;if T1 is notrunning then start it
noise:
reti ;return with T1 enabled to time pulse
stop:
setb wflg ;set flag to indicate measurement done
clr ex1 ;disable INT1 until next measurement
reti ;return with T1 stopped and wflg set
;the main program is placed here. the program monitors wflg and display the high pulse width on P1 (LSBY) and P2 (MSBY).
;the width is accurate to the nearest microsecond
over:
mov tmod,#90h ;T1 to count when INT1 pin high
setb it1 ;INT1 interrupt on negative edge
mov tl1,#00h ;reset T1 to 00h
mov th1,#00h
mov ie,#84h ;enable global and INT1 interrupts
simulate:
jbc wflg,getwidth ; test flag til measurement made
sjmp simulate ; loop til finish
getwidth:
mov p1,tl1 ;display LS Byte on P1
Mov p2,th1 ;display MS byte on P2
sjmp over
.end
so in the last part of the code in the "getwidth" part...how the pulse width in milisecond can be save into P1 (port 1)and P2(port2)...i mean in what form...let's say for example pulse width with 45.6milisecond...how it gonna to be kept in the MSB and LSB onto P1 and P2? help, anyone..
cheers,
bok