VBA-datasave-01.txt

Togotech (토론 | 기여)님의 2024년 7월 3일 (수) 08:49 판 (새 문서: E5071C VBA 프로그래밍 <pre> Private Sub UserForm_Click() Dim FmtData As Variant, Freq As Variant Dim SaveData(99, 800) Dim File As String Dim dmy As Long Dim start,...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

E5071C VBA 프로그래밍

	Private Sub UserForm_Click()
	Dim FmtData As Variant, Freq As Variant
	Dim SaveData(99, 800)
	
	Dim File As String
	Dim dmy As Long
	Dim start, finish
	
	File = "2.txt"
	Open File For Output As #1
	
	SCPI.SENSe(1).SWEep.POINts = 801
	Nop = SCPI.SENSe(1).SWEep.POINts
	SCPI.DISPlay.ENABle = False
	'SCPI.DISPlay.ENABle = True
	
	ECHO "Nop=", Nop
	
	SCPI.TRIGger.SEQuence.Source = "BUS"
	
	Freq = SCPI.SENSe(1).FREQuency.DATA
	
	start = Timer
	For i = 0 To 99
	    SCPI.TRIGger.SEQuence.SINGle
	    dmy = SCPI.IEEE4882.OPC
	    FmtData = SCPI.CALCulate(1).SELected.DATA.FDATa
	    For j = 0 To Nop - 1
	        SaveData(i, j) = FmtData(2 * j)
	    Next j
	Next i
	finish = Timer
	ECHO "Elapsed Time=", finish - start
	
	For j = 0 To Nop - 1
	    Print #1, j + 1, Freq(j);
	    For i = 0 To 99
	        Print #1, SaveData(i, j);
	    Next i
	    Print #1,
	Next j
	Close #1
	
	MsgBox "Measurement Completion"
	SCPI.SYSTem.BEEPer.COMPlete.IMMediate
	
	End Sub