• Content Count

  • Joined

  • Last visited

About Lesiastas

  • Rank
    Frequent Visitor

Recent Profile Visitors

223 profile views
  1. Hi @attila I'm having a hard time figuring out where to insert the snippet of code you've provided. I'd like to ask where should I place it in this VB Script I'm working on. Public Shared Function AD2_RecordStart(ByVal hdwf As Integer, ByVal fReconfigure As Integer, ByVal fStart As Integer, ByVal fReadData As Integer, ByRef sts As Byte, ByVal cSamples As Integer, ByVal cBuffer As Integer, ByRef cAvailable As Integer, ByRef cLost As Integer, ByRef cCorrupted As Integer, ByRef rgData() As Byte) As Integer 'Record Parameters ReDim rgData(cSamples) Dim fOverflow As Boolean : fOverflow = False Dim iSample As Integer : iSample = 0 If cSamples > cBuffer Then ' record While iSample < cSamples If FDwfDigitalInStatus(hdwf, fReadData, sts) = 0 Then Return 0 End If If sts = DwfStateDone Or sts = DwfStateTriggered Then FDwfDigitalInStatusRecord(hdwf, cAvailable, cLost, cCorrupted) If cLost <> 0 Or cCorrupted <> 0 Then fOverflow = True End If cAvailable = Math.Min(cAvailable, cSamples - iSample) Dim rgTemp(cAvailable) As Byte ' in other programming languages use pass pointer to rgData[iSample] FDwfDigitalInStatusData(hdwf, rgTemp, 1 * cAvailable) For i = 0 To cAvailable - 1 rgData(iSample) = rgTemp(i) iSample = iSample + 1 Next End If If sts = DwfStateDone Then Exit While End If End While Else While True If FDwfDigitalInStatus(hdwf, 1, sts) = 0 Then Return 0 End If If sts = DwfStateDone Then Exit While End If End While iSample = rgData.Length FDwfDigitalInStatusData(hdwf, rgData, 1 * rgData.Length) End If End Function Best regards, Lesiastas
  2. Hi @attila I'm really sorry for the confusion that I've caused you. What I'm doing is I'm observing the behavior of the AD2 in the WF application and I integrate those into the VB Script I'm working on. Then if I encounter a really hard showstopper, that's when I go and ask the forums for more details. Thanks for this advice! I'll try exploring the different settings of DwfParamOnClose I'm sorry to be a bother but can you please explain this quote further? Thank you in advance! Best regards, Lesiastas
  3. Hi @attila Thank you for clearing that one. I'll apply that concept to the code I'm working on. Does this mean I have to set the following APIs to these parameters: Dim cSamplesAfterTrigger As Long : cSamplesAfterTrigger = 18000 Dim cSamples As Long : cSamplesAfterTrigger = 18000 'Logic Parameters FDwfDigitalInTriggerSourceSet(phdwf, trigsrcDetectorDigitalIn) FDwfDigitalInTriggerSet(phdwf, 0, 0, 0, &HFFFF) FDwfDigitalInDividerSet(phdwf, (100000000.0 / 230400)) FDwfDigitalInSampleFormatSet(phdwf, 8) FDwfDigitalInBufferSizeInfo(phdwf, BufferSize) If cSamples > BufferSize Then FDwfDigitalInAcquisitionModeSet(phdwf, acqmodeRecord) FDwfDigitalInTriggerPrefillSet(phdwf, 0) FDwfDigitalInTriggerPositionSet(phdwf, cSamplesAfterTrigger) FDwfDigitalInSampleSensibleSet(phdwf, &HFFFF) Else FDwfDigitalInBufferSizeSet(phdwf, cSamples) FDwfDigitalInTriggerPositionSet(phdwf, cSamples - 10) End If Best regards, Lesiastas
  4. Hi @attila Thanks for reminding me about some information about my previous posts. I've determined why my VB Script is taking too long. It's not because of the Logic Analyzer's Record Mode, it's because of the Analog Discovery 2's FDwfDeviceConfigOpen. I've done 10 trials in measuring the Logic Analyzer Record Mode in the VB Script I'm working on: AD2_Time_Testing.rar The AD2_RecordStart first enables the trigger for the Logic Analyzer and then starts the transmission of the Pattern Generator. This ensures that data is received. It's average test time is 0.03 seconds, which is acceptable. The thing that I observed is regarding the FDwfDeviceConfigOpen's test time. I've done 10 trials to measure it and these are the results: I've measured all the other functions in the VB Script that I'm working on. The DeviceConfigOpen produces the longest time before opening. It takes about 325 milliseconds for the Analog Discovery 2 to open, which is too long. Can the time it takes for FDwfDeviceConfigOpen to finish be lessened or does it really take this long? Best regards, Lesiastas
  5. Hi @attila Does this mean I have to set FDwfDigitalInTriggerPrefillSet(hdwf, 0) to this values? Best regards, Lesiastas
  6. Hi @attila Thanks for pointing that out. I've tried it in the WaveForms GUI Application and the way I see it, the record mode fills the sample size set before returning results. This will take some additional test time in the application that I'm using it for. I've created a custom script for both the Pattern Generator and Logic Analyzer using VB6.(AD2_Time_Testing.rar) The setup that I am working on is this: 1). I'm using the Pattern Generator to transmit 256 characters. DIOs #0 and #1 are used as the Transmitter pins. 2). I'm using the Record Mode of the Logic Analyzer to receive a minimum of 9k characters. DIOs #2 and #3 are used as the Receiver pins. The Tx side is already working well, the only thing that concerns me is the way Record Mode behaves. I need it to stop recording once all of the 256 characters has been received. What I'm getting is it continues recording even though all of the 256 characters has been received already. To put it simply, I would like the record mode to behave like 'Single' mode in the WF Logic Analyzer app as well as receive a minimum of 9k characters. Is it possible to set the record mode in this manner? Please check the custom script that I've attached in this post. I'm open to any changes in order to improve it. Best regards, Lesiastas
  7. Greetings! i'm working on a project involving the use of the Logic Analyzer function of the Analog Discovery 2. I have observed that its Record Mode can be used to capture huge samples of data. The only problem that I'm having is it takes too long for the Record Mode to fill its memory before returning results even when the sample size used is 20k. I would like to know if it is possible to make the Record Mode of the Logic Analyzer intelligent in a way by making it stop filling its memory when the data to be transmitted has already been received. Because the application that I'm using Record Mode for should do so in order to return results faster. Any advice would help a lot. Best regards, Lesiastas
  8. Greetings! I'm working on a project using the Analog Discovery 2. I observed that the Pattern Generator can be used as a Transmitter and the Logic Analyzer can be used as a Receiver, if used properly. Here's the VB Script that I've been working on: AD2_Time_Testing.rar The VB Script does the following: 1). ASCII data is entered. 2). The algorithm in the code will convert it into binary to be transmitted by the Pattern Generator. 3). The Logic Analyzer will receive the bits in Record Mode. 4). The UART decoder algorithm will convert the bits received back into ASCII character. The result that I'm expecting is this: "U" ---> (Converted into Binary) ---> (Transmitted by the Pattern Generator) --> (Bits received in Record Mode) --->(BIts will be converted back in ASCII) ---> "U" The actual result that I'm getting is this: (DIO#0 (Tx) and DIO#2 (Rx) was used) Data that is to be transmitted: I connected DIO #0 to DIO #2 and a UART controller. Data was sucessfully transmitted and it was received by the UART controller: I also observed the bits returned by the FDwfDigitalInStatusData became like this: I think because of this change the UART Decoder algorithm cannot process it properly. That's why I'm getting this result: The output of DIO0Mesg should be "U" as well. Any advice regarding this? Best regards, Lesiastas AD2_Time_Testing.rar
  9. Hi @attila Thanks for the advice regarding the Analog Discovery 2's Device Configuration. I applied your advice and I can now transmit messages with more than 102 characters using the Pattern Generator Script I'm working on. I used DIO #0 and #1 to transmit several paragraphs from a piece I've found. Here is the result that I was able to receive using 2 UART Controller: It was able to transmit it perfectly! Thank you for your guidance! More power to you and Digilent! Best regards, Lesiastas
  10. Greetings, I'm working on a project utilizing the Pattern Generator function of Analog Discovery 2. I chose the Pattern Generator function based from the WaveForms GUI. In that interface, it can be used to transmit data in parallel. I created a VB Script consisting of Pattern Generator APIs, it was working fine. The problem that I encountered is its possible limitation: it can only transmit up to 102 characters. Each character consists of 10 bits (1 Start bit, 8 Data bits, and 1 Stop bit). Here are example of that scenarios: 1). Transmitted messages using DIOs #0 and #1 were received by 2 UART Controllers successfully. 1st message was exactly 102 characters. I added another character to the longer message and it became 103 characters. 2). The received results of the 2 UART Controllers is this: It was just blank for the other trials that I've done. My question is can the Pattern Generator be used to transmit data with a length more than 102 characters? If I want to transmit a minimum of 256 characters, can the Pattern Generator handle it? Any advice will surely help. Best regards, Lesiastas
  11. Hi @attila Thank you again for all the support you've provided me for the past weeks. I am now capable of receiving more than 409 characters using the Wrapper I created base from your example. It uses the Record acquisition mode and I set the buffer size to 3 million for now. I'll increase it when the need arises. I used 1 UART controller and branched out its Tx pin to 2 DIO pins of the AD2 (DIO #0 & 1). I transmitted 500 characters: (If Record mode is not the acquisition mode, the received result will be blank) For DIO # 0, it received: with a length of: For DIO #1, it received: with a length of: I could not have done it without your guidance, thank you again and more power to you and Digilent Best regards, Lesiastas
  12. Hi @attila Thank you very much for the support! Your snippet of code has been working on my end too. Now I'm implementing the necessary APIs base from your example to be used in Record Mode for the Wrapper that I'm creating. I'm trying to figure out what values these should return: Because I keep getting this error regarding the Return statement. Any advice? Best regards, Lesiastas
  13. Hi @attila I observed that the maximum size received by the FDwfDigitalInStatusData is 409 characters. I transmitted 420 characters: (I counted the "0" to confirm its 420 characters) What I received was this: Its length is only 409, a few characters were missing. I also tried changing cSamples to a higher value: The result is: All bits returned were high bits and no ASCII values were decoded. Here's my question: If I want to receive a minimum of 8000 characters, which is better to use: the Record Mode or the Repeated Mode of the WF Logic Analyzer app? If you'll recommend Record Mode, can you please provide an example on how to use FDwfDigitalInStatusRecord? Because the example available in the samples folder is quite confusing. Best regards, Lesiastas
  14. Hi @attila Thanks for all the help! I managed to replace all unsupported operators in VBA to make it work as expected. I'm now able to receive the raw samples from FDwfDigitalInStatusData and parse it to return ASCII values. I transmitted ASCII "vu": And the result in VBA is this: (DIO #0 & #1 were used for reception) Orange = represents start & stop bits. Yellow = represents bit sequence of ASCII ā€œvā€. Green = represents bit sequence of ASCII ā€œUā€. Other examples that I used are also successful: I also tried other values for the variable pin and I got the results that I wanted as well. Thanks again for all the help and support. More power to you and Digilent Best regards, Lesiastas
  15. Hi @attila I've gotten the results that I wanted! Thanks for all the help regarding the UART Decoder Algorithm! Examples of the received and parsed messages that I used are: I also increased the buffer size to 4095 to accommodate for messages with bigger size. Result is: The next step for me is to reference the working VB Logic Analyzer Wrapper to a VBA Macro Script Project. Errors occurred and I observed that the UART Decoder Algorithm uses some operators not supported by VBA. Can you please help me understand what should I do to fix this error? Best Regards, Lesiastas