Public Class Form1 '-- C DLL FUNCTION PROTOTYPES --' Declare Sub ADWGC Lib "ADWGC.dll" () Declare Sub AnalyserC Lib "AnalyserC.dll" () Declare Sub Terminate Lib "ADWGC.dll" () Declare Function GetNrSamples Lib "ADWGC.dll" () As Integer Declare Function ver Lib "ADWGC.dll" Alias "Ver" () As Integer Declare Function ReadConfAndDataFile Lib "ADWGC.dll" (ByVal FileName As String, ByVal Message As Integer) As Integer Declare Sub ClearBuffer Lib "ADWGC.dll" () Declare Sub Abort Lib "ADWGC.dll" () Declare Function WriteSingleSample Lib "ADWGC.dll" (ByVal Data As Integer) As Integer Declare Function WriteMultiSample Lib "ADWGC.dll" (ByRef Data() As Integer, ByVal Length As Integer) As Integer Declare Function AdwgRun Lib "ADWGC.dll" (ByVal SendSamples As Integer, ByVal StepStart As Integer, ByVal Message As Integer) As Integer Declare Function AdwgRunLoop Lib "ADWGC.dll" (ByVal SendSamples As Integer, ByVal StepStart As Integer, ByVal Message As Integer) As Integer Declare Sub SetDataMaskOut Lib "ADWGC.dll" (ByRef DataMaskOut As Integer) Declare Sub GetDataMaskOut Lib "ADWGC.dll" (ByRef DataMaskOut As Integer) Declare Sub SetStaticData Lib "ADWGC.dll" (ByVal Data As Integer) Declare Sub SetReqClock Lib "ADWGC.dll" (ByVal ReqClock As Integer) Declare Function GetReqClock Lib "ADWGC.dll" () As Integer Declare Function GetSynthClock Lib "ADWGC.dll" () As Integer Declare Sub SetInfiniteLoop Lib "ADWGC.dll" (ByVal Enable As Byte) Declare Function IsRunning Lib "ADWGC.dll" () As Byte '--Trigger Functions Declare Sub SetInternalTrigger Lib "ADWGC.dll" (ByVal Internal As Byte) Declare Function GetInternalTrigger Lib "ADWGC.dll" () As Byte Declare Sub SetCtrlTrigMask Lib "ADWGC.dll" (ByRef Mask As Integer) Declare Sub SetCtrlTrigPattern Lib "ADWGC.dll" (ByRef Pattern As Byte) Declare Function SetAutoReArm Lib "ADWGC.dll" (ByVal AutoRearm As Byte) As Integer Declare Sub SPIIC Lib "SPIIC.dll" () '--Ctrl Line Functions Declare Sub SetCtrlMaskOut Lib "ADWGC.dll" (ByRef CtrlMaskOut As Integer) Declare Sub DisDefaultCtrl Lib "ADWGC.dll" () Declare Sub SetCtrlDefaultVal Lib "ADWGC.dll" (ByRef DefaultVal As Integer) Declare Sub GetCtrlDefaultVal Lib "ADWGC.dll" (ByRef CtrlDefaultVal As Integer) Declare Sub DisCtrlSeq Lib "ADWGC.dll" () Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ADWGC() End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim Res As Integer Res = Ver() MsgBox("Software version is " & Res) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ' Button for reading file Dim Res As Integer Dim FileName As String FileName = "c:\SimpleAdwgConfAndData.cfg" Res = ReadConfAndDataFile(FileName, 1) MsgBox("Result of read :" & Res) End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Terminate() End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Dim SampleValue As Integer Dim Res As Integer Dim i As Integer SampleValue = 12345 For i = 0 To 64 Res = WriteSingleSample(SampleValue + i) Next i End Sub Private Sub TextBox1_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click Dim Freq As Integer Dim FreqIn As Integer Freq = GetReqClock() MsgBox("Current req clock is: " & Freq) FreqIn = 5000 MsgBox("Programmed Value: " & FreqIn) SetReqClock(FreqIn) Freq = GetReqClock() MsgBox("Current req clock is: " & Freq) FreqIn = 2000 SetReqClock(FreqIn) Freq = GetReqClock() MsgBox("Current req clock is: " & Freq) End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click Dim MaskOut As Integer Dim MaskOutReturned As Integer MaskOutReturned = 50 MaskOut = 60000 SetDataMaskOut(MaskOut) GetDataMaskOut(MaskOutReturned) MsgBox("DataMaskOut : " & MaskOutReturned) End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click Dim SynthClock As Integer SynthClock = GetSynthClock() MsgBox("Syntesized Clock :" & SynthClock) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim SampleValue As Integer Dim Res As Integer Dim i As Integer Dim FileName As String Dim ReturnedValue As Integer Dim MaskOutReturned As Integer Dim ParamValue As Integer ' Programming a first configuration / data set 'FileName = "c:\SimpleAdwgConfAndData.cfg" 'Res = ReadConfAndDataFile(FileName, 1) 'Enabling 3 output data lines 0x0013 = 19 MsgBox("New data mask out : " & MaskOutReturned) ParamValue = 19 SetDataMaskOut(ParamValue) GetDataMaskOut(MaskOutReturned) MsgBox("New data mask out : " & MaskOutReturned) 'Adding one single data to the loaded data set = 0xFFFF WriteSingleSample(65535) WriteSingleSample(65535) WriteSingleSample(0) WriteSingleSample(65535) 'WriteSingleSample(16) 'WriteSingleSample(3) 'WriteSingleSample(12345) 'WriteSingleSample(65535) 'WriteSingleSample(19) ''Doing a run of 80 samples 'Res = AdwgRun(80, 0, 1) 'MsgBox("Run result :" & Res) 'Clearing data buffer ClearBuffer() ''Adding one single data to the loaded data set = 0xAAAA 'WriteSingleSample(43690) 'Running 10 samples (10x the same!) 'Res = AdwgRun(10, 0, 1) 'MsgBox("Result of Run: " & Res) End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click Dim SampleValue As Integer Dim Res As Integer Dim i As Integer Dim FileName As String Dim ReturnedValue As Integer Dim MaskOutReturned As Integer Dim ParamValue As Integer ' Programming a first configuration / data set FileName = "c:\SimpleAdwgConfAndData.cfg" Res = ReadConfAndDataFile(FileName, 1) MsgBox("Result of read:" & Res) 'Displaying the programmed clock frequency ReturnedValue = GetSynthClock() MsgBox("Programmed clock frequency : " & ReturnedValue) ' Changing the requested frequency and checking the actual synthesized frequency ' Requested frequency: 5 MHz SetReqClock(5000000) ReturnedValue = GetSynthClock() MsgBox("New programmed clock frequency : " & ReturnedValue) ' Reading the current data mask out MaskOutReturned = 50 GetDataMaskOut(MaskOutReturned) MsgBox("Current data mask out : " & MaskOutReturned) 'Enabling all output data lines 65535 = 0xFFFF ParamValue = 65535 SetDataMaskOut(ParamValue) GetDataMaskOut(MaskOutReturned) MsgBox("New data mask out : " & MaskOutReturned) 'Adding one single data to the loaded data set = 0x5555 WriteSingleSample(21845) 'Doing a run of 80 samples Res = AdwgRun(80, 0, 1) MsgBox("Run result :" & Res) 'Clearing data buffer ClearBuffer() 'Adding one single data to the loaded data set = 0xAAAA WriteSingleSample(43690) 'Running 10 samples (10x the same!) Res = AdwgRun(10, 0, 1) MsgBox("Result of Run: " & Res) End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click SPIIC() End Sub End Class