• Content Count

  • Joined

  • Last visited

  1. Hi @attila Thanks for the advice 😆 I'll try just that. Sorry for more questions but: 1. What values should I set to the FDwfDigitalInAcquisitionModeSet, FDwfDigitalInDividerSet, FDwfDigitalInSampleModeSet, FDwfDigitalInTriggerPositionSet, and FDwfDigitalInTriggerSet for Repeated Acquisition Mode in Analog Discovery 2? 2. And lastly, what values should I set to the FDwfDigitalInTriggerSet in order for it to trigger on Falling Edges using DIO Channel 0? Yours truly, Lesiastas
  2. Hi @attila I found a thread which seems very similar to what I'm working on. The main difference is I want to use a UART Controller to send an ASCII character and have the FDwfDigitalInStatusData API display the bits of the ASCII character. Here's the VB6 code that I've come up with the help of the thread that I read. Imports UART_Single_Acquisition.ComClass1 Imports System.Windows.Forms Imports System.Text Imports System.Text.RegularExpressions Public Class Form1 Private Sub UartButton1(ByVal sender As System.Object, ByVal e As EventArgs) Handles Button1.Click Dim UART As New UART_Single_Acquisition.ComClass1 Dim handle As Integer Dim sts As Byte Dim phzFreq As Double Dim hzDI As Double Dim hzData As Double : hzData = 9600 Dim idxChannel As Integer : idxChannel = 0 Dim cSamples As Integer : cSamples = 2 * 8 Dim rgwData(cSamples) As UInt16 'Dim pfAuto As Integer 'Opening Device Call AD2_FDwfDeviceOpen(-1, handle) Call AD2_FDwfDigitalOutReset(handle) Call AD2_FDwfDigitalInReset(handle) 'DigitalOut APIs Call AD2_FDwfDigitalOutInternalClockInfo(handle, phzFreq) Call AD2_FDwfDigitalOutEnableSet(handle, idxChannel, 1) Call AD2_FDwfDigitalOutIdleSet(handle, idxChannel, 2) 'DwfDigitalOutIdleHigh As Byte = 2 Call AD2_FDwfDigitalOutDividerSet(handle, idxChannel, (phzFreq / hzData)) 'Call AD2_FDwfDigitalOutCounterSet(handle, idxChannel, 1, 1) Call AD2_FDwfDigitalOutRunSet(handle, (cSamples / phzFreq)) Call AD2_FDwfDigitalOutRepeatSet(handle, 1) 'DigitalIn Parameters Call AD2_FDwfDigitalInInternalClockInfo(handle, hzDI) Call AD2_FDwfDigitalInTriggerSourceSet(handle, 3) 'trigsrcDetectorDigitalIn As Byte = 3 Call AD2_FDwfDigitalInTriggerAutoTimeoutSet(handle, 10.0) Call AD2_FDwfDigitalInSampleModeSet(handle, 1) 'DwfDigitalInSampleModeSimple As Byte = 0 Call AD2_FDwfDigitalInDividerSet(handle, (hzDI / hzData)) 'Use 8 for 8bit, 16 for 16bit and 32 for 32bit samples Call AD2_FDwfDigitalInSampleFormatSet(handle, (16)) Call AD2_FDwfDigitalInBufferSizeSet(handle, cSamples) Call AD2_FDwfDigitalInTriggerPositionSet(handle, (cSamples - 1)) Call AD2_FDwfDigitalInTriggerSlopeSet(handle, 1) 'DwfTriggerSlopeFall As Byte = 1 'Call AD2_FDwfDigitalInTriggerSet(handle,0,0,&HFFFF,&HFFFF) 'DigitalIn Enable Call AD2_FDwfDigitalInConfigure(handle, 0, 1) 'DigitalOut Enable Call AD2_FDwfDigitalOutConfigure(handle, 1) 'Acquisition State Call AD2_FDwfDigitalInStatus(handle, 1, sts) '1* for 8bit, 2* for 16bit, 4* for 32bit samples Call AD2_FDwfDigitalInStatusData(handle, rgwData, (2 * cSamples)) 'Done Call AD2_FDwfDeviceClose(handle) End Sub End Class Sincerely yours, Lesiastas
  3. Hi @attila A follow-up question: What is the API function to set the Trigger Mode settings? (The highlighted settings in the picture below) I've checked the APIs available in the reference manual but there is no TriggerMode API in there. Sincerely yours, Lesiastas
  4. Hi @attila Is it not possible to replicate the function of the Logic Analyzer GUI without using the FDwfDigitalUart functions? Because I was advised to see if I can get the Signal Bus functions of the Logic Analyzer GUI to work in the API first. Only then we'll proceed with using the UART Bus present in the Logic Analyzer GUI. Sorry if its a bit confusing, but I'll also try your advice
  5. Greetings! I'm working on a project involving the use of the Analog Discovery 2's Logic Analyzer feature and I've been tasked to recreate its function through the use of a VB6 Wrapper. I'm having a hard time finding the correct APIs to use. The Python sample codes in the WaveForms SDK folder isn't working when I tried to use it in receiving ASCII bits from a UART controller. For people like me that aren't good in coding, it would be great if it would at least contain more examples showing the different uses of the settings present in the Logic Analyzer GUI. So I just set some additional APIs that could help my code and here's the code that I've made so far: The main showstopper that I've encountered right now is the highlighted API in the picture above. It's suppose to retrieve the acquired data samples from the instrument, but it still cannot receive the bits of the ASCII character that I'm sending. This is the result that I'm trying to replicate using the Logic Analyzer APIs: I used a UART Controller as the Tx to the VB6 Wrapper while I was doing breakpoint debug in it to see the received bits. These are the results that I got: It received a "1" and "0" bits unlike the one in the Logic Analyzer GUI. I could be wrong, but I think the problem is I still haven't set the Trigger and Trigger Detector APIs for the Logic Analyzer properly. Any advice guys?
  6. Thanks @jpeyron and @attila. I did not know that you can change the declaration in the wrapper because my supervisor told me not to touch anything in there. I'll try to implement this and see if it'll work. Thanks again you guys and God Bless
  7. Greetings! I'm currently working on a project involving the use of the Analog Discovery 2's Logic Analyzer. I was tasked to created a VB6 Wrapper to replicate the functions of the Logic Analyzer WaveForms GUI. I'm not very knowledgeable in coding so I was wondering how to translate this python variable from the DigitalIn_Acquisition sample code into its VB6 equivalent: Here's the VB6 code that I made: Again, I'm very sorry, but I'm still a novice at coding. Though I understand that you can't insert a UShort value in a 1-Dimensional Byte Array, I can't think of a way to declare it in order to agree with the Byte Array Data Type. Any advice guys?
  8. Thanks for the welcome @jpeyron! Is it okay if I ask for the link of the section that you've transferred my topic to? yours truly, Lesiastas
  9. Greetings! I'm working on a Project involving the use of the Analog Discovery 2's Pattern Generator function. I was tasked to create a VB6 Wrapper in MS Visual Studio 2013 that will perform the functions of the Pattern Generator by calling certain APIs from its dwf VB.NET file. I have two concerns on how to do this. First, as I looked at the WaveFormsSDK sample codes and the WaveFormsâ„¢ SDK Reference Manual, there is no API available for setting the clock frequency of the Pattern Generator, unlike in its WaveForms GUI. The only API available is the FDwfDigitalOutInternalClockInfo, which only retrieves the internal clock frequency, not set it to want I need. Secondly, what I need is to sucessfully transmit an ASCII character using the APIs of the Pattern Generator. I'm a novice at coding, especially with complicated routines, so I'm having trouble with coding for the FDwfDigitalOutDataSet API. What I want to do is to send an ASCII character using a string variable that will be converted into its binary equivalent using the snippet of codes below and store those values to the rgBits variable, which is a byte array to transmit it. For example, I'll use ASCII character "U", convert it to its binary form which is Bin(01010101) and put those values in the rgBits variable to be sent to a UART Controller or Logic Analyzer to see if it was transmitted properly. I came up with these codes but I don't think its the correct way of doing it. Sorry but I'm really, really not that good at coding. It would really help to receive some advice on how to do it. 'Convert String to Binary Dim Text As String = TextBox1.Text Dim oReturn As New StringBuilder 'but first, convert String to Byte() Dim PatGenTx As String = ("") Dim rgBits() As Byte ReDim rgBits(0 To Len(PatGenTx)) For i = 1 To Len(PatGenTx) rgBits(i) = Asc(Mid(PatGenTx, i, 1)) Debug.Print(rgBits(i)) Next 'Then store binary values into byte array For Each Character As Byte In ASCIIEncoding.ASCII.GetBytes(Text) oReturn.Append(Convert.ToString(Character, 2).PadLeft(8, "0")) oReturn.Append(PatGenTx) Next TextBox2.Text = (oReturn.ToString) 'Take note: bits order is lsb first ' for TS output the count of bits its the total number of IO|OE bits, it should be an even number ' BYTE: 0 |1 ... ' bit: 0 |1 |2 |3 |...|7 |0 |1 |... ' sample: IO|OE|IO|OE|...|OE|IO|OE|... Dim countOfBits As UInteger : countOfBits = 8 Thank you and God Bless you guys.