	DIMENSION IOSB(2),YLD(2000)
	LOGICAL*1 FNAME(50)
	WRITE(5,1)
1	FORMAT(1X,5X,' ENTER DESIRED YIELD RATE          ',$)
	READ(5,2)YK
2	FORMAT(F15.7)
	WRITE(5,10)
10      FORMAT(1X,5X,'PLEASE INPUT SAMPLING RATE <CYCLES/SEC>.   '
     C,$)
	READ(5,20)K
20	FORMAT(I4)
	Q=1./K
	CDT=100.*Q
	TI=0.0
	N=0
	T=SECNDS(0.0)
30	CALL DOUT(0, ,IOSB,3)
	IF(IOSB(1).NE.1)GO TO 30
40	N=N+1
	CALL ADINP(0,0,IVAL1)
	CALL ADINP(0,1,IVAL2)
	CALL ADINP(0,2,IVAL3)
	YLD(N)=(IVAL3*1000.)/4095.
	T1=IVAL1
	T2=(YK-(IVAL2/4095.)*495.-367.)*4095./321.
	T12=T1-T2
	T21=T2-T1
	IF(T21.GE.CDT)GOTO 12
	IF(T12.GE.CDT)GOTO 13
	GOTO 15
12	ID=4095
 	GOTO 9
13	ID=0
	GOTO 9
15	ID=(2047.+T21*2047./CDT)
9	CALL DAOUT(0,ID)
	TI=TI+Q
50	DELTA=SECNDS(T)
	IF(DELTA.LT.TI)GO TO 50
	IF(DELTA.GT.60.)GO TO 100
	GO TO 40
100	CALL DOUT(0, ,IOSB,0)
	IF(IOSB(1).NE.1)GO TO 100
	CALL ASSIGN(3,'YIELD.DAT')
	WRITE(3,122)(YLD(JK),JK=1,N)
122	FORMAT(5F12.7)
	WRITE(5,123)
123	FORMAT(1X, 'INPUT FILE NAME FOR STATISTICAL ANALYSIS',3X,$)
	READ(5,127)(FNAME(LK),LK=1,50)
127	FORMAT(50A1)
	CALL ASSIGN(4,FNAME)
	EM=0
	IN=K*20
	CALL SUB(IN,N,YLD,EM,YK)
	CALL CLOSE(3)
	CALL CLOSE(4)
	STOP
	END
