Search the Community

Showing results for tags 'analog discover 2'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • Add-on Boards
    • Scopes & Instruments and the WaveForms software
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 11 results

  1. Hi, I have a question about Waveforms 3 API relevant to the oversampling functionality implemented in Analog Discovery 2. Recently, I am trying to implement the oversampling functionality for my custom-coded software (written in C#) using Waveforms 3 APIs (3.12.2). Based on the reference manual in the SDK, I think that the relevant APIs are “FDwfAnalogInAcquisitionModeSet”, “FDwfAnalogInSamplingDelaySet”, and/or “FDwfAnalogInTriggerPositionSet”. I also found the (seemingly) relevant constants for the first function as follows: “acqmodeOvers = 4” or “acqmodeSingle1 = 5” in “dwf.cs” and “dwf.h”. I am now wondering if acqmodeOvers = 4 should be used for the FDwfAnalogInAcquisitionModeSet function; and the FDwfAnalogInSamplingDelaySet is the function (not FDwfAnalogInTriggerPositionSet). I am afraid that I do not understand what the “sampling source” exactly does in the FDwfAnalogInSamplingDelaySet, DwfAnalogInSamplingSlopeSet, and FDwfAnalogInSamplingSourceSet functions. If anyone can tell me the detail (or indicate some documentation), I appreciate it! Thank you in advance, Yasuo
  2. Hello, I am having issues with my analog discovery 2. When I try accessing the device in the device manager of waveforms, I keep getting the same error code listed below. I have tried redownloading the waveforms software, but this hasn't fixed the issue. Any help would be greatly appreciated. Thanks for the help!
  3. Greetings, I am working on a project using the Pattern Generator and Logic Analyzer functions of Analog Discovery 2. I'm trying to figure out the proper arrangements of bits to be assigned to the Pattern Generator so that the Logic Analyzer can receive it in UART format properly. Let's say I want to transmit the word "UART" using the Pattern Generator. Here's how I'm doing it using the Custom Signal setting in the Pattern Generator: The bits highlighted in green are the start and stop bits while those in yellow are the inverted data bits of the word "UART". I also adjusted the Run and Repeat time to only transmit it once. (40/9600 = 0.004166666) I transmitted it to the Logic Analyzer and it was able to receive it using the UART setting. The problem that I see with this is if you want to transmit a single character, you'll need 10 bits for it. For big data, it will take too long to be received by the Logic Analyzer. I was wondering if the Pattern Generator can be set up like this: 1 start bit + (32 Data bits of "UART") + 1 stop bit This reduces the no. of bits by only using the start and stop bits at the beginning and at the end of the data to be transmitted. I tried doing this by rearranging the bits, the run time and repeat settings in the Pattern Generator: The results that I got using the Logic Analyzer became incorrect for the next characters: I'm also trying to do it in VB. Here's the code for it: Imports System.Text Module Module1 Function AD2_UARTCommRead(ByVal hdwf As Integer, ByRef rgData() As Byte, ByVal countOfDataBytes As Integer, ByVal hzRate As Integer, ByVal hzUart As Integer, ByVal pin As Integer, ByRef rgParsed As String, ByRef rgLength As Integer) As Integer 'Customized Uart Decoder Dim pData As Boolean Dim fData As Boolean : fData = True Dim cSamples As Integer : cSamples = rgData.Length Dim rgHex(cSamples) As Byte Dim cSamplePerBit As Integer : cSamplePerBit = hzRate / hzUart 'Decoding Raw Samples into Decimal For i = 0 To cSamples - 1 Dim s As Byte : s = rgData(i) pData = fData fData = 1 And (s >> pin) If pData <> 0 And fData = 0 Then Dim bValue As Integer : bValue = 0 For b = 0 To 7 Dim ii As Double : ii = Math.Round(i + (1.499 + b) * cSamplePerBit) ''''' If ii >= cSamples Then Exit For End If s = rgData(ii) fData = 1 And (s >> pin) If fData Then bValue = bValue + (1 << b) End If Next rgHex(i) = bValue i = i + cSamplePerBit * 9.499 - 1 '1 start + 8 bits + 0.5 stop -1 because For will increment End If Next 'Converting Decimal to ASCII Dim rgString As String For e = 0 To cSamples - 1 If rgHex(e) = 0 Then rgString = rgString Else rgString = rgString + Chr(rgHex(e)) End If Next e rgParsed = rgString rgLength = Len(rgParsed) End Function Function AD2_FDwfDigitalOutDataLong(ByVal Hdwf As Integer, ByVal IdxChannel As Integer, ByRef RgLong As String, ByVal LongBits As Integer) As Integer 'Post Processing Method 'Conversion of ASCII String to Binary Dim Text As String : Text = RgLong Dim n As Integer : n = Len(Text) Dim oReturn As New StringBuilder Dim StartBit As String : StartBit = "0" Dim StopBit As String : StopBit = "1" oReturn.Append(StartBit) For Each Character As Byte In System.Text.ASCIIEncoding.ASCII.GetBytes(Text) oReturn.Append(StrReverse(Convert.ToString(Character, 2).PadLeft(8, "0"))) 'oReturn.Append((Convert.ToString(Character, 2).PadLeft(8, "0"))) Next oReturn.Append(StopBit) Dim Text2 As String : Text2 = (oReturn.ToString) 'Padding of Additional 1s Dim Counter As Integer : Counter = Len(Text2) Dim PadMod As Integer : PadMod = (Counter + (Counter + (Counter Mod 8))) Mod 8 Dim PadBin As String : PadBin = New String("1", PadMod) Text2 = Text2 + PadBin Dim PadResult As Integer : PadResult = Counter + PadMod 'Chunking of Bits into 8 Dim RevBytes(PadResult) As String For e As Integer = 0 To RevBytes.Length - 8 Step 8 RevBytes(e) = Text2.Substring(e, 8) Next e Dim backup As String Dim Extracted(PadResult) As String Dim TxBits(PadResult) As Byte Dim f As Integer, x As Integer Dim lTemp As Integer : lTemp = 0 Dim lngValue As Integer 'Inverting and Conversion of Bits For f = 0 To RevBytes.Length backup = StrReverse(RevBytes(8 * f)) If backup = "" Then Extracted(f) = "0" Extracted(f) = Extracted(f) & backup 'Conversion of Binary to Decimal lngValue = Convert.ToInt32(Extracted(f), 2) TxBits(f) = lngValue lngValue = 0 If TxBits(f) = 0 Then Exit For Next f Call FDwfDigitalOutDataSet(Hdwf, IdxChannel, TxBits, PadResult) End Function Sub Main() Dim hdwf As Long ' 3 = 4th device configuration of AD2 with 16k digital-in/out buffer If FDwfDeviceConfigOpen(-1, 3, hdwf) = False Then Dim szError As String FDwfGetLastErrorMsg(szError) System.Console.WriteLine("Device open failed" & vbCrLf & szError, vbExclamation + vbOKOnly) End End If FDwfDeviceAutoConfigureSet(hdwf, 0) ' only the #Configure functions will apply settings ' UART channels: DIO-0 and DIO-1, h3 = (1 << 0)|(1 << 1) Const nLoop = 744 Const fsDio = &HFFFF Const hzUart = 230400 Const hzRate = hzUart * 1 ''''' Const cSamples = 8 * 4 'RgLong is 4 characters Dim cBuffer As Integer Dim RgLong As String : RgLong = "UART" Dim secRun As Double : secRun = (Len(RgLong) * 8) * (1 / hzUart) Dim phzFreq As Double 'PatGen Parameters - Initialized One Time FDwfDigitalOutInternalClockInfo(hdwf, phzFreq) FDwfDigitalOutRepeatSet(hdwf, 1) FDwfDigitalOutRunSet(hdwf, secRun) 'Enabling DIO-0 FDwfDigitalOutEnableSet(hdwf, 0, 1) FDwfDigitalOutTypeSet(hdwf, 0, 1) FDwfDigitalOutIdleSet(hdwf, 0, 2) FDwfDigitalOutDividerSet(hdwf, 0, (phzFreq / hzUart)) Dim hzDI As Double FDwfDigitalInInternalClockInfo(hdwf, hzDI) FDwfDigitalInTriggerSourceSet(hdwf, trigsrcDetectorDigitalIn) ' 'Falling Edge of any specified channel FDwfDigitalInTriggerSet(hdwf, 0, 0, 0, fsDio) FDwfDigitalInDividerSet(hdwf, hzDI / hzRate) FDwfDigitalInSampleFormatSet(hdwf, 8) FDwfDigitalInBufferSizeInfo(hdwf, cBuffer) If cSamples > cBuffer Then ' FDwfDigitalInAcquisitionModeSet(hdwf, acqmodeRecord) FDwfDigitalInTriggerPrefillSet(hdwf, 0) 'Number of samples after trigger FDwfDigitalInTriggerPositionSet(hdwf, cSamples) 'We are interested only on toggles of the specified channels FDwfDigitalInSampleSensibleSet(hdwf, fsDio) Else FDwfDigitalInBufferSizeSet(hdwf, cSamples) FDwfDigitalInTriggerPositionSet(hdwf, cSamples - 10) End If 'Processing Data for Transmission AD2_FDwfDigitalOutDataLong(hdwf, 0, RgLong, 510) 'Data needs to be tested for 744 times Dim StartTime As Double Dim SecondsElapsed As Double 'Measuring Test Time StartTime = Timer If cSamples <= cBuffer Then ' prime for repeated captures FDwfDigitalInConfigure(hdwf, 1, 1) ' it will rearm for consecutive iterations FDwfDigitalOutConfigure(hdwf, 1) End If For i = 0 To nLoop - 1 Dim rgData(cSamples) As Byte Dim sts As Byte Dim fOverflow As Boolean = False Dim iSample As Integer = 0 If cSamples > cBuffer Then ' record FDwfDigitalInConfigure(hdwf, 1, 1) ' restart is only required for record FDwfDigitalOutConfigure(hdwf, 1) Dim cAvailable As Integer Dim cLost As Integer Dim cCorrupted As Integer While iSample < cSamples If FDwfDigitalInStatus(hdwf, 1, sts) = 0 Then Return 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 l = 0 To cAvailable - 1 rgData(iSample) = rgTemp(i) 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 End If If sts = DwfStateDone Then Exit While End If End While iSample = rgData.Length FDwfDigitalInStatusData(hdwf, rgData, 1 * rgData.Length) If i < nLoop - 1 Then FDwfDigitalOutConfigure(hdwf, 1) ' start next while processing data below End If End If Dim DIO0Used As Long : DIO0Used = 2 'DIO #2 Dim DIO0Mesg As String : DIO0Mesg = "" Dim DIO0Length As Long AD2_UARTCommRead(hdwf, rgData, (1 * cSamples), hzRate, hzUart, DIO0Used, DIO0Mesg, DIO0Length) Next i '***************************** 'Determine how many seconds code took to run 'Notify user in seconds SecondsElapsed = Math.Round(Timer - StartTime, 6) Console.WriteLine("This code ran successfully in " & SecondsElapsed & " seconds.\n") Console.WriteLine((nLoop) & " x" & (1000 * SecondsElapsed / nLoop) & "ms loop latency:" & (1000 * (SecondsElapsed / nLoop - cSamples / hzRate)) & "ms") FDwfDeviceCloseAll() End Sub End Module Can anyone please explain why this is the case? Any advice will do. Best regards, Lesiastas
  4. Greetings! I'm working on a project involving the use of the AD2's Logic Analyzer Function. I need to receive 510 bytes of data in the shortest time possible. My questions are: 1). Can the Single/Repeated Acquisition Mode of the Logic Analyzer handle 510 bytes of data? - I observed that it can only handle up to 4096 samples and 1 byte of the data I'm handling is 10 bits (1 start bit, 8 data bits, 1 stop bit). So all in all, the Single/Repeated Acquisition Mode can only handle 409 bytes of data. Is there a way to make it capable of handling 510 bytes of data? 2). What is the fastest acquisition mode of the Logic Analyzer Function? - I observed that the Record Mode can handle thousands of data. The downside is it takes a very long time to receive data. Whenever I use the Record Mode, I receive all of the 510 bytes of data. The problem is I end up with 20.5 seconds before the results are displayed and that is too long. 3). What is the best acquisition mode if I want to receive 510 bytes of data as fast as possible? Any advice would really help. Best regards, Lesiastas
  5. Greetings, Is there a way to receive 0/1 values for the captured samples using FDwfDigitalInStatusData? I tried transmitting ASCII "a" but the result for each channel is different. I expected and wanted a result of Binary (1000 0110) using ASCII "a", but the actual result that I got was different for each DIO channels. Actual result using DIO #0 = (1)000 0(1)(1)0 Actual result using DIO #1 = (2)000 0(2)(2)0 Actual result using DIO #2 = (4)000 0(4)(4)0 Actual result using DIO #7 = (128)000 0(128)(128)0 I want the result from DIO #1, 2, and 7 to display 0/1 values, but I haven't had any breakthroughs so far. I'm aware that I asked this question sometime ago, but I decided to start a new thread because the other one is too long already. The previous advice that was given to me is from this link: The problem is, I did not fully understand how to apply it to the code I'm working on given below: Dim idxDevice As Integer : idxDevice = -1 Dim handle As Integer 'LA Parameters Dim phzFreq As Double Dim acqMode As Integer : acqMode = 0 Dim trigSrc As Byte : trigSrc = 3 'trigsrcDetectorDigitalIn As Byte = 3 'Set Trigger Bits for Channels to be used Dim LowStateTrigger As UInteger : LowStateTrigger = 0 Dim HighStateTrigger As UInteger : HighStateTrigger = 0 Dim RisingEdgeTrigger As UInteger : RisingEdgeTrigger = 0 Dim FallingEdgeTrigger As UInteger : FallingEdgeTrigger = &HFFFF Dim BaudRate As Double : BaudRate = 9600 Dim nBits As Integer : nBits = 16 Dim SampleMode As Integer : SampleMode = 0 'DwfDigitalInSampleModeSimple As Byte = 0 '4096 for 8bit, 2048 for 16 bit, 1024 for 32bit Dim cSamples As Integer : cSamples = 2048 Dim cSamplesAfterTrigger As Integer : cSamplesAfterTrigger = cSamples - 1 Dim fReconfigure As Integer : fReconfigure = 0 Dim fStart As Integer : fStart = 1 Dim fReadData As Integer : fReadData = 1 Dim sts As Byte Dim rgwData(cSamples) As UInt16 Dim countOfDataBytes As Integer : countOfDataBytes = 2 * cSamples 'Opening Device Call AD2_FDwfDeviceOpen(idxDevice, handle) 'DigitalIn Parameters Call AD2_FDwfDigitalInInternalClockInfo(handle, phzFreq) Call AD2_FDwfDigitalInAcquisitionModeSet(handle, acqMode) Call AD2_FDwfDigitalInTriggerSourceSet(handle, trigSrc) Call AD2_FDwfDigitalInTriggerSet(handle, LowStateTrigger, HighStateTrigger, RisingEdgeTrigger, FallingEdgeTrigger) Call AD2_FDwfDigitalInTriggerAutoTimeoutSet(handle, 10.0) Call AD2_FDwfDigitalInDividerSet(handle, (phzFreq / BaudRate)) Call AD2_FDwfDigitalInSampleFormatSet(handle, nBits) Call AD2_FDwfDigitalInSampleModeSet(handle, SampleMode) Call AD2_FDwfDigitalInBufferSizeSet(handle, cSamples) Call AD2_FDwfDigitalInTriggerPositionSet(handle, cSamplesAfterTrigger) 'Configure for Reception Call AD2_FDwfDigitalInConfigure(handle, fReconfigure, fStart) 'Start Reception Call AD2_FDwfDigitalInStatus(handle, fReadData, sts) 'Retrieves Captured Samples Call AD2_FDwfDigitalInStatusData(handle, rgwData, countOfDataBytes) 'Closing Device Call AD2_FDwfDigitalInReset(handle) Call AD2_FDwfDeviceClose(handle) Any advice would really help a lot. Thanks in advance Regards, Lesiastas
  6. Greetings, I am creating a VBA Macro Script to enable the Pattern Generator function of Analog Discovery 2 for parallel transmission of data. I've already created a VB6 Wrapper (Pattern_Generator) containing these two files: 1). Pattern Generator Wrapper.txt(Calls APIs from dwf.vb) 2). dwf.vb I've referenced it to a VBA Script to call those functions using this snippet of codes: Public TxWrapper As Pattern_Generator.ComClass1 Public Function PatGenForTx() Set TxWrapper = New Pattern_Generator.ComClass1 'PatGen Parameters Dim rgBits1 As String: rgBits1 = "UART" Dim n As Long: n = Len(rgBits1) + 1 Dim idxDevice As Long: idxDevice = -1 Dim handle As Long Dim phzFreq As Double Dim idxChannel1 As Long: idxChannel1 = 0 Dim fEnable As Long: fEnable = 1 Dim secRun1 As Double: secRun1 = (n * 8) * (1 / 9600) Dim cRepeat As Long: cRepeat = 1 Dim t As Long: t = 1 ''DwfDigitalOutTypeCustom As Byte = 1 Dim i As Long: i = 2 ''DwfDigitalOutIdleHigh As Byte = 2 Dim countOfBits1 As Long: countOfBits1 = n * 8 Dim fStart As Long: fStart = 1 'Initializing Device PatGen = TxWrapper.AD2_FDwfDeviceOpen(idxDevice, handle) 'Setting for enabling 1st Channel PatGen = TxWrapper.AD2_FDwfDigitalOutInternalClockInfo(handle, phzFreq) PatGen = TxWrapper.AD2_FDwfDigitalOutEnableSet(handle, idxChannel1, fEnable) PatGen = TxWrapper.AD2_FDwfDigitalOutRunSet(handle, secRun1) PatGen = TxWrapper.AD2_FDwfDigitalOutRepeatSet(handle, cRepeat) PatGen = TxWrapper.AD2_FDwfDigitalOutTypeSet(handle, idxChannel1, t) PatGen = TxWrapper.AD2_FDwfDigitalOutIdleSet(handle, idxChannel1, i) PatGen = TxWrapper.AD2_FDwfDigitalOutDividerSet(handle, idxChannel1, (phzFreq / 9600)) PatGen = TxWrapper.AD2_FDwfDigitalOutDataSet(handle, idxChannel1, rgBits1, countOfBits1) 'Start Site 1 Transmission PatGen = TxWrapper.AD2_FDwfDigitalOutConfigure(handle, fStart) 'Closing Device PatGen = TxWrapper.AD2_FDwfDigitalOutReset(handle) PatGen = TxWrapper.AD2_FDwfDeviceCloseAll() End Function But I am encountering this error at the FDwfDigitalOutDataSet: Any advice? Regards, Lesiastas
  7. Hello, I am working on a project that uses the Analog Discovery 2 to measure the response of a DUT over a long period (hours or days). I am working in LabVIEW and have been building this project using the foundation provided in the LabVIEW project shared here. It uses both the Waveform Generator functionality to apply a signal and the Scope functionality to measure the response. Currently, I am running into a problem where my code stops working after 250 minutes. It seems to be very consistent. I and another have replicated the issue using multiple AD2 devices, multiple PCs, and both the LabVIEW source code as well as compiled into an executable. I have used LabVIEW to do profiling on the memory usage and such of the application and I do not believe I have a memory leak eating away at the PC. Also, the timeout is very repeatable to 250 minutes. The log files always end after that amount of time has passed. Is it possible that the AD2 session has a timeout built into it somehow? If so, how do I reset the AD2 before the timeout occurs? I looked through the SDK and did not find a function call that appeared to be the obvious one to use. Any help would be appreciated! Thank you.
  8. Hello Digilent Forums, I am trying to write a Python script for the impedance analyzer. I am reading the WaveForms SDK and following examples. I noticed all methods in the examples that use the dwf (Ex: `dwf.FDwfDeviceOpen`) use positional arguments. In the SDK, it lists the parameter names/types for the method (Ex: `FDwfDeviceOpen(int idxDevice, HDWF *phdwf)`). I have tried and failed to figure out how to specify them using keyword arguments instead. Is it possible? Thank you in advance for your help!
  9. I would like to use the Analog Discovery 2 to look at the carrier signal coming in from an AM broadcast station. To do this I would need to tune or filter the many signals coming in on my antenna down to one station of interest. I am thinking that this type of tuning is not something that the AD2 can do. Is this correct? Does anyone know of a simple device that can act as a front end to the AD2 to tune and perhaps amplify the signal in this way? I have looked into SDR's that are very focused on doing just this but I am not seeing how I can extract the carrier signal before it goes to mixing and demodulation.
  10. I've followed the directions for updating the driver in this forum, no luck. I get a device cannot start when updating the drivers. No LEDs light in the Analog Discover 2. I get a "USB Device not Recognized". My AD2 has worked for a long time on 3 computers, now it's quite dead. It was working just before I shut down my computer while Win 10 updates were lurking. It could be the AD2 was starting to fail. It was constantly getting disconnected. Any ideas? Thanks, Mike Yee
  11. Is it possible to fill the buffer of a Scope Math channel from a script?[i] = some value Thanks in advance, Greg