	character*35 out
	logical over

	open(unit=10,file='Vf.dat')

	call ieopen(1,'gpib1')
	call egstatus(ibsta,iberr,iegerr,ibcntrl)
	print*,ibsta,iberr,iegerr,ibcntrl

	call IEk192init(1,21,1,0)
c	subroutine IEk192init(iunit,iadd,ifunct,irange)
c for controlling keithley model 192 DMM
c
c  iunit: unit number for connection established with IEopen
c   iadd: primary address of device [20,21]
c ifunct: 0:DCV, 1:ACV, 2:OHM
c irange: 0:auto, 1:.2, 2:2, 3:20, 4:200, 5:2000, 6:20M
c
	call IEk192status(1,21,out)
c	subroutine IEk192status(iunit,iadd,out)
	print*,out

	call IEw23reset(1,9)
c	subroutine IEw23reset(iunit,iadd)
c for controlling wavetek model 23 function generators
c
c  iunit: unit number for connection established with IEopen
c   iadd: primary address of device [8,9]

	call IEw23status(1,9,out,f,a1,o)
c	subroutine IEw23status(iunit,iadd,out,freq,amp,offset)
c for controlling wavetek model 23 function generators
c
c  iunit: unit number for connection established with IEopen
c   iadd: primary address of device [8,9]
c    out: string in which output is placed [34 bytes max]
c   freq: frequency in Hz
c    amp: amplitude in V
c offset: DC offset in V (-5.1 to 5.1)
	print*,out,f,a1,o

	print*,'enter fstart, fstop, n'
	read*,fstart,fstop,n
	write(10,*)fstart,fstop,n

c	subroutine IEk192read(iunit,iadd,xx,xerror,over)
c for controlling keithley 192 DMM
c takes multiple readings and reports stable result or enlarges error accordingly
c
c  iunit: unit number for connection established with IEopen
c   iadd: primary address of device [20,21]
c ifunct: 0:DCV, 1:ACV, 2:OHM
c irange: 0:auto, 1:.2, 2:2, 3:20, 4:200, 5:20M
c     xx: reading
c xerror: calibration error from manual
c   over: flags errors, including overflow

c	subroutine IEw23(iunit,iadd,ifunct,imode,freq,amp,offset)
c for controlling wavetek model 23 function generators
c
c  iunit: unit number for connection established with IEopen
c   iadd: primary address of device [8,9]
c ifunct: 0:sin, 1:square, 2:triangle, 3:rampUp, 4:rampDown, 5:DC
c  imode: 0:continuous, 1:triggered, 2:gated, 3:trigHaver, 4:gateHaver, 5:clock, 6:synthesized
c   freq: frequency in Hz
c    amp: peak-to-peak amplitude in V (into 50 ohms, so typically will be larger) max: 10.2
c offset: offset in V (-5.1 to 5.1)
c
c if imode=6, freq is changed to reflect the exact valued produced


	do i=1,n
		f=fstart*(fstop/fstart)**(float(i)/n)
		call IEw23(1,9,0,0,f,3.34,0.)
		call IEk192read(1,21,v,ve,over)
		if(over)stop
		print*,f,v,ve
		write(10,*)f,v,ve
	enddo
	call ieclose(2)
	close(10)

	end

