Search the Community

Showing results for tags 'python'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • Add-on Boards
    • Scopes & Instruments
    • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 40 results

  1. Hi,guys! I'm currently working on how to send character"hello" to FPGA and then transmit "hello" back to my PC. But it seems I only can send some characters to my board and cannot receive the chracters back to PC. I wonder how to build my code in python to get the characters back to my PC. The attachment is my code(PYTHON) and result of runing. import serial ser = serial.Serial("com9",9600,timeout=0.25) print(ser.name) print(ser.port) #ser.open() c=input("hello") b=ser.isOpen() s=ser.read(10) ser.write(c.encode()) print(s) print(b) ser.close() Thanks, Dehao
  2. Hi, I am writing a python script to output patterns on my digital discovery. I need to have a reset at 0 during 100ns on DIO24=channel 0, then 20000pattern that are repeated. But I do not want to repeat the reset. I have tried many commands of the SDK ref manual, including Reset = 0 dwf.FDwfDigitalOutRepeatTriggerSet(hdwf, c_int(Resetn), c_int(1)) # repeat = false But, no way the reset is always repeated. How to proceed ? BRgds, Laurent
  3. Hi there, Until here, I've done quite a few things, with the magnificient help of attila. I've done a lot a threads that can use the AD2 to record the analog inputs, or the digital inputs, that can configure the analog outputs or the digital outputs. When I run all of those threads together, it works perfectly fine (except for the tick of my PC, that doesn't allow me to be really fast with the digital outputs, but it's not a big problem for the moment). And then, the UART appeared. I have to say, it works great. The problem is with the UART and the digital outputs. When both are asked (for example logic '1' to DIO 0 and send "This is just a simple test to know if everything works fine" on the Tx at the <<same>> time, the DIO will wait for the end of the UART Transmit). I've tested with with another configuration for the digital output (pulse at 1kHz), and the AD2 stops the pulse when the UART appears. Is it normal or do I do something wrong? Thanks for your help Marc
  4. Hello Digilent Forums, I have an Analog Discovery 2 + Impedance Analyzer board, and have been programmatically manipulating the board via the DWF library. I am now trying to plot Input Phase (∠) programmatically. The SDK for Python comes with a `dwfconstants.py`, which houses values of `c_int()`, corresponding with various measurement types. For example, `DwfAnalogImpedanceImpedance` measurement type corresponds to `c_int(0)`. I do not see a constant for Input Phase inside `dwfconstants.py`. Is it possible to get Input Phase? Thank you in advance for your help!
  5. Greetings, Forgive me, but I'm not that knowledgeable in python and I'm having trouble understanding the "create_string_buffer" argument in the Digital_UART.py sample code. How do you declare this "create_string_buffer" statement into its VB6 equivalent? Sincerely yours, Lesiastas
  6. 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!
  7. Hello, I'm using the AD2 and would like to use Python to play an imported signal of arbitrary length (like in the function AnalogOut_Play) while at the same time acquiring data (like in the function AnalogIn_Record). Is there a straightforward way of combining these two functions?
  8. Hi, I combined a few python scripts from the SDK (AnalogIn_Acquisition, AnalogOut_Play and AnalogOut_Sine) to write a script which is intended to run during the night and save the scope's data into a WAV file. All looks somewhat okay, but there are a few things that don't look perfect. For this test, I connected CH1 and W1 and started both the Scope and Signal generator in the script. I'm intending to generate a 80 Hz sine wave and record it with the scope running at 8 kHz. I attach the whole script, and here are the important parts: # set up signal generation channel = c_int(0) # use W1 dwf.FDwfAnalogOutNodeEnableSet(hdwf, channel, AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, channel, AnalogOutNodeCarrier, funcSine) # ! this looks like a square wave dwf.FDwfAnalogOutNodeFrequencySet(hdwf, channel, AnalogOutNodeCarrier, c_double(signalgenhz)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeCarrier, c_double(1.41)) # ! this doesn't really do anything dwf.FDwfAnalogOutNodeOffsetSet(hdwf, channel, AnalogOutNodeCarrier, c_double(1.41)) I played around with the parameters and after some investigation with Audacity it seems like the funcSine parameter generates a square wave and the amplitude is always 1.0 no matter what I set. The other problem I have is with the FDwfAnalogInStatusData function, it looks like it doesn't just get the raw data from the scope, is contains something else. So in order to get the scope's CH1 data, I need to have a 2-channel WAV file, and discard its first channel. The second is the data I'm looking for. waveWrite = wave.open(startfilename, "wb"); waveWrite.setnchannels(2); # 2 channels for the testing (1 channel would be enough if FDwfAnalogInStatusData returned only 1 channel's data waveWrite.setsampwidth(4); # 32 bit / sample waveWrite.setframerate(samplerate); waveWrite.setcomptype("NONE","No compression"); dwf.FDwfAnalogInStatusData(hdwf, 0, rgdSamples, buffersize) # get channel 1 data CH1 - ! it looks like 2 channels get read here and only the second is the data of CH1 waveWrite.writeframes(rgdSamples); I would expect that if I only need the CH1 of the Scope, I could save it into a mono WAV file. AnalogIn_AcquisitionSaveToWAV.py
  9. Hi, I have been using the Waveforms in Mac to control digital discovery. And I am now familiar with using the scripts in Waveforms. I want to use Tool.start option to run python from Waveforms. Below is the command I am using based on the format. But I haven't been successful with running python. Tool.start("/Users/venkatap/anaconda2/bin/python", "/Users/venkatap/Waveforms_v1/py_files/run_file.py","/tmp/") As all the examples and discussions about this topic are related to windows machine, I wanted to know how to use the Tool.start option in Mac. Kindly assist me with this. Thank you, Praveen
  10. Hi all, I am working on SPI transceiver with AD2 in master mode. I am using python sample codes provided. transmitting is working fine but in receiving i am able to get the signals on wire but not to the variable in python rgwRX = (c_uint16*1)() while True: dwf.FDwfDigitalSpiSelect(hdwf, c_int(4), c_int(0)) dwf.FDwfDigitalSpiRead16(hdwf, c_int(2), c_int(24),rgwRX, c_int(len(rgwRX))) dwf.FDwfDigitalSpiSelect(hdwf, c_int(4), c_int(1)) print rgwRX[0] I am getting only '0's corresponding signal while receiving tapped on CRO is attached and it is proper but when i try it using Waveforms software it works but i see same signal on wire
  11. Hi all i am using Analog discovery 2 for communication purpose.(CAN) I tried using the sample code given same as attached. I am using PCAN to send/receive frames to analog discovery 2 , I am sending only one frame with Standard ID : 0x011 and Data: 0xaa 0xbb 0xcc 0xdd 0xee 0xff but i am receiving lot of Frames with the same ID sent, lot of extended remote frames with CRC errors ,etc. I have attached the console output for reference. Can I know why i am facing the issue? I tried same experiment with waveforms still having similar issue. I have attached the screen shot of it. Digital_Can.py CAN_Console.txt
  12. I am using analog discovery 2 to send/Receive signals with PCAN using python. Do i need to have a CAN transceiver IC to convert from CAN-H/L to CAN-Rx/Tx? Also wanted to know if i use Waveforms software, what is the hardware connection?
  13. Hello, I have some problems with jitter with analog discovery 2 during acquisition with a python script. I used both AnalogIn_Record.py (after parsing with futurize to comply with python 3.5) and a modified version using ScanScreen as acquisition mode (see attachment). The last one can run much faster than the suggested AnalogIn_Record.py. I can reach 1MHz sampling rate. """ DWF Python Example Author: Digilent, Inc. Revision: 10/17/2013 Requires: Python 2.7, numpy, matplotlib python-dateutil, pyparsing """ from __future__ import division from __future__ import print_function from builtins import range from past.utils import old_div from ctypes import * from dwfconstants import * import math import time import matplotlib.pyplot as plt import sys from scipy.fftpack import fft import numpy as np if sys.platform.startswith("win"): dwf = cdll.dwf elif sys.platform.startswith("darwin"): dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf") else: dwf = cdll.LoadLibrary("libdwf.so") #declare ctype variables hdwf = c_int() sts = c_byte() hzAcq = c_double(1000000) hzGen = c_double(1000000/8) nSamples = 1000000 rgdSamples = (c_double*nSamples)() #rgdSamples16 = (c_short*nSamples)() pidxWrite = c_int() acqMode = acqmodeScanScreen filterMode = filterAverage #print DWF version version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: "+version.value.decode("utf-8")) #open device print("Opening first device") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) if hdwf.value == hdwfNone.value: szerr = create_string_buffer(512) dwf.FDwfGetLastErrorMsg(szerr) print(szerr.value.decode("utf-8")) print("failed to open device") quit() print("Preparing to read sample...") print("Generating sine wave...") dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, hzGen) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(2)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) #set up acquisition dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) dwf.FDwfAnalogInAcquisitionModeSet(hdwf, acqMode) dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq) dwf.FDwfAnalogInChannelFilterSet(hdwf, c_int(0), filterMode) bufferLength = 8192 dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(bufferLength)) sts = c_int() dwf.FDwfAnalogInBufferSizeGet(hdwf, byref(sts)) print("Buffer length ", sts.value) bufferLength = sts.value #wait at least 2 seconds for the offset to stabilize time.sleep(2) #begin acquisition dwf.FDwfAnalogInConfigure(hdwf, c_int(0), c_int(1)) print(" waiting to finish") #time.sleep(0.1) cSamples = 0 sts = c_ubyte() cSamplesValid = c_int() idx = 1 pidxWrite = c_int() iterations = 1; while cSamples < nSamples: # Count iterations iterations += 1 dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) # print(sts.value) if cSamples == 0 and (sts == DwfStateConfig or sts == DwfStatePrefill or sts == DwfStateArmed) : # Acquisition not yet started. continue # Read index dwf.FDwfAnalogInStatusIndexWrite(hdwf, byref(pidxWrite)) # Calculate how many new samples are in the buffer availableSamples = (pidxWrite.value - idx)%(bufferLength) if cSamples + availableSamples > nSamples : availableSamples = nSamples-cSamples if idx + availableSamples <= bufferLength: dwf.FDwfAnalogInStatusData2(hdwf, c_int(0), byref(rgdSamples, sizeof(c_double)*cSamples), c_int(idx), c_int(availableSamples)) cSamples += availableSamples #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples, ", cSamples: ", cSamples) idx = pidxWrite.value else: #print("wrapping") #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples) availableSamples1 = bufferLength-idx dwf.FDwfAnalogInStatusData2(hdwf, c_int(0), byref(rgdSamples, sizeof(c_double)*cSamples), c_int(idx), c_int(availableSamples1)) cSamples += availableSamples1 #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples1, ", cSamples: ", cSamples) idx = 0 availableSamples2 = availableSamples-availableSamples1+1 dwf.FDwfAnalogInStatusData2(hdwf, c_int(0), byref(rgdSamples, sizeof(c_double)*cSamples), c_int(idx), c_int(availableSamples2)) cSamples += availableSamples2 #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples2, ", cSamples: ", cSamples) idx = pidxWrite.value #print(iterations, "idx: ", idx, ", pidxWrite: ", pidxWrite.value, ", Valid samples: ", availableSamples, ", cSamples: ", cSamples) print("Recording finished") # Close device dwf.FDwfDeviceCloseAll() # rgpy=[0.0]*len(rgdSamples) for i in range(0,len(rgpy)): rgpy[i]=rgdSamples[i] # Plot plt.figure(1) plt.clf() plt.plot(rgpy, '.') plt.show() # Plot fft a = np.array(rgpy) A = fft(a)/len(a) plt.figure(2) plt.clf() plt.semilogy(abs(A)) The problem however is not the speed, but the jitter which can be seen by the fft plot or by the drift of the lines in the standard plot when hzGen is a small sub-multiple of hzAcq (see figure). There is a 50 mV drift in 1 s. Is this depending on python code and on the host pc (ubuntu 16.04) or is implicit in the device? I would not expect such a large jitter from this kind of hardware. Is there a way to improve? Thank you in advance for the kind help. Best, Alberto
  14. I have a embedded device which has live waveforms steaming based on the data given to device via simulator. Can you guys pls suggest how can i automate that waveforms using python/Squish tool.Its urgent. Pls reply if you have any thoughts regarding this.
  15. Hi All, I have a embedded device which has live waveforms steaming based on the data given to device via simulator. Can you guys pls suggest how can i automate that waveforms using python/Squish tool.Its urgent. Pls reply if you have any thoughts regarding this.
  16. can we use output from python code in verilog on pynq board. e.g if we take hdmi in python. Can we process that frames in verilog.? Thanks
  17. I had a working Debian 8 production system using python2.7 to talk to an Analog Discovery 2. I decided to update the .deb packages to be current and now I get "Segmentation fault" "stack smashing detected" when I try to start my python program. I was using the amd64.deb files: digilent.adept.runtime 2.16.6 digilent.waveforms 3.5.4 (for the libdwf.so file) Upgraded to digilent.adept.runtime 2.17.1 digilent.waveforms 3.7.5 Also on the system is digilent.adept.utilities 2.2.1. I tested just upgrading the runtime package and my program works. Upgrading the waveforms package (and thus libdwf.so) causes the segfault. Any thoughts on how I might track down where the problem is?
  18. I'm writing an I2C interface in python in order to get a real-time stream from a peripheral device and do some additional processing. I have been able to get everything set up such that my peripheral ACKs my request. However, I'm curious for what your strategy is for handling the next packet depending on ACK/NACK. Originally I was just using a digital read at the start of the transmit (Start + Address) and processing the response to detect ACK, then setting up the device for the next transmit (data). However, the USB back/forth is way too slow, so I'm assuming you set everything up in advance in Waveforms I2C to trigger on an ACK. I tried a few methods of setting the output to trigger from I/O states, but I haven't been able to get it to work quite right (is there a way to force a trigger?). Can you briefly explain the general flow for how you set the AD2 up to handle I2C as master in Waveforms? Thanks, Kyle
  19. Hi all, actual i try to transfer a data stream from the DMA via uart to my PC. In my design an DDS-compiler generates a 32bit sine wave, which should be transfered via uart and read by a python script. The general data transfer works, but sometimes i get some noisy signal. This signal happens also when using a lower sample rate. For the uart data transfer actual i did not add any marker where the 32 bit value begins or ends. So i expect this is the problem, but i don't know how to include this in my SDK and python code. Maybe any suggestion? (The FPGA design is similar to my previous post https://forum.digilentinc.com/topic/8966-axi-dma-timing/?page=0#comment-26920 using the Cmod A7) Plot of the result with pyqtgraph: SDK code: int XAxiDma_Poll_Uart(u16 DeviceId) { int Status, Index; int Tries = NUMBER_OF_TRANSFERS; u32 *RxBufferPtr; u32 *RxPacket; u8 BytesSent; RxBufferPtr = (u32 *) RX_BUFFER_BASE; RxPacket = (u32 *) RX_BUFFER_BASE; for (Index = 0; Index < MAX_PKT_LEN_WORDS; Index ++) { RxBufferPtr[Index] = 0xCC; } /* Flush the SrcBuffer before the DMA transfer, in case the Data Cache is enabled*/ Xil_DCacheFlushRange((u32)RxBufferPtr, MAX_PKT_LEN); Status = XAxiDma_SimpleTransfer(&AxiDma, (u32) RxBufferPtr, MAX_PKT_LEN, XAXIDMA_DEVICE_TO_DMA); if (Status != XST_SUCCESS) {return XST_FAILURE;} while (XAxiDma_Busy(&AxiDma, XAXIDMA_DEVICE_TO_DMA)) {/* Wait*/} /* Invalidate the TestBuffer before receiving the data, in case the Data Cache is enabled*/ Xil_DCacheInvalidateRange((u32)RxPacket, MAX_PKT_LEN); //send data to uart BytesSent = XUartLite_Send(&UartLite, RX_BUFFER_BASE, sizeof(RxPacket)); while (XUartLite_IsSending(&UartLite)) {/*Wait*/} return XST_SUCCESS; } Python code: import numpy as np import sys import serial buffersize = 512 byte_number = 4 ser = serial.Serial( port='COM6',\ baudrate=921600,\ parity=serial.PARITY_NONE,\ stopbits=serial.STOPBITS_ONE,\ bytesize=serial.EIGHTBITS,\ timeout=0) for u in range(20): #read serial buffer s = ser.read(buffersize) #convert to integer for i in range (int(len(s)/byte_number)): res_value = dataSerial[(i*byte_number):((i+1)*byte_number)] value = int.from_bytes(res_value, byteorder='little', signed = True) dataSerialFormated = np.append(dataSerialFormated, value)
  20. Hi! My goal is to use the Analog Digital 2 in order to move a piezoelectric via stick slip motion. I want to program this into a python script so that I can move the stage one step, record data for x amount of time, move the stage one step, record data, etc. In order to do this, I want to output a specific number of sawtooth wave periods (one to two) at a certain frequency. From these posts (https://forum.digilentinc.com/topic/4084-analog-discovery-2-waveform-generator/ , https://forum.digilentinc.com/topic/2609-how-to-create-one-pulse-via-sdk/#comment-9014), I have figured out how to do this through the GUI. I have also followed the example scripts and can output standing wave forms, just not pulses. So now, I am looking for some guidance in putting these together. Can you give me some suggestions, advice, or code snippets that might allow me to accomplish this? Are there any functions in the dwf module that might work? Any help is welcome and appreciated! Thanks, Harry digilentScreenCap
  21. Hello, I may have a bug to report. It appears that the latest version of Waveforms 3 on Windows 7 and 8 does not support the python hooks and API. I have rolled my version back to the previous version and it appears to work fine. We just wanted to make sure to bring this to light as it hopefully will not continue through future versions of Waveforms. Thanks, Dylan
  22. Hi, I am trying to do some test automation on the electronics explorer board. I have been looking through the Javascript and Python documentation and haven't been able to find a good mapping of values passed to the API's and where they correspond to the on-board resources. Does one exist? I have really been struggling for example trying to enable/change power supplies. Have variable Vp/Vn values and Vcc (on/off/5v/3.3v). Thank you for your time! Dylan
  23. I want to be able to output a .wav file. I can output a sine wave just fine from python, but I'm having trouble with this. I am loading the wav file. The array is populated. I've been looking for a funcPlay example, but I have not found any. I am able to import the file into waveforms and send it out using play. Thanks. import numpy as np import scipy.io.wavfile import matplotlib.pyplot as plt import ctypes import winsound from ctypes import * import time from dwfconstants import * import sys rate, data = scipy.io.wavfile.read('/Users/don/1.wav') plt.plot(data) plt.show() sin_data = np.sin(data) if sys.platform.startswith("win"): dwf = cdll.dwf elif sys.platform.startswith("darwin"): dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf") else: dwf = cdll.LoadLibrary("libdwf.so") # declare ctype variables hdwf = c_int() channel = c_int(1) # print DWF version version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: {}".format(version.value)) # open device print("Opening first device...") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) c_double_p = ctypes.POINTER(ctypes.c_double) data_p = data.ctypes.data_as(c_double_p) if hdwf.value == hdwfNone.value: print("failed to open device") quit() print("Generating audio...") print("Configure and start first analog out channel") print("Generating custom waveform...") dwf.FDwfAnalogOutNodeEnableSet(hdwf, channel, AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, channel, AnalogOutNodeCarrier, funcPlay) dwf.FDwfAnalogOutNodeDataSet(hdwf, channel, AnalogOutNodeCarrier, data_p, data.size) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, channel, AnalogOutNodeCarrier, 44100) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeCarrier, c_double(2)) dwf.FDwfAnalogOutConfigure(hdwf, channel, c_bool(True)) dataLost = c_int(0) dataFree = c_int(0) dataCorrupted = c_int(0) psts = c_int(0) dwf.FDwfAnalogOutNodePlayStatus(hdwf, channel, AnalogOutNodeCarrier, dataFree, dataLost, dataCorrupted) dwf.FDwfAnalogOutStatus(hdwf, channel, psts) print("psts: {}".format(psts)) print("dataLost: {}".format(dataLost)) print("dataFree: {}".format(dataFree)) print("dataCorrupted: {}".format(dataCorrupted)) while psts != DwfStateDone: dwf.FDwfAnalogOutNodePlayStatus(hdwf, channel, AnalogOutNodeCarrier, dataFree, dataLost, dataCorrupted) dwf.FDwfAnalogOutStatus(hdwf, channel, psts) dwf.FDwfAnalogOutNodePlayData(hdwf, channel, AnalogOutNodeCarrier, data_p, data.size) # if state == c_int(0): # print("state is 0") # dwf.FDwfAnalogOutNodePlayData(hdwf, channel, AnalogOutNodeCarrier, data_p, data.size) # print("Configure and start first analog out channel") # dwf.FDwfAnalogOutEnableSet(hdwf, c_int(0), c_int(1)) # print("1 = Sine wave") # dwf.FDwfAnalogOutFunctionSet(hdwf, c_int(0), c_int(1)) # dwf.FDwfAnalogOutFrequencySet(hdwf, c_int(0), c_double(3000)) # print("") # dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1)) time.sleep(10) print("done.") dwf.FDwfDeviceClose(hdwf)
  24. Hello, I'm starting to work with custom scripts on my discovery 2 (with oscilloscope extension + probes). I'm trying to setup a measurement environment using the AnalogIn_Acquisition.py sample script. I have a power supply with output voltage at 4V. When I run the scope at WaveForms I get 4V reading, however, when I run the acquisition script I get 2.72V as average voltage. I also tried with the AnalogIn_Sample.py script and also get 2.73V. I wonder why such different results. Pictures bellow:
  25. After going through a range of the SDK examples, I'm running into some strange behavior that I'm hoping someone can help explain. The result I'm trying to achieve is sending out a low duty cycle pulse (Digital or Analog but something similar to a TTL) that triggers the repeated acquisition on the Analog Discovery. I can achieve this result using the GUI but would like to insert this process into a python script so I can process and save the data. When I route W1 into CH1 in the following example what I see is expected. However, when I try to route the digital out into CH1 things look extremely wonky. Again, I'd like to see a waveform that would be considered a PWM waveform that has a duty cycle of ~99% low and I'd like to be able to control that duty cycle with a reasonable degree of precision and accuracy. Any help would be appreciated and hope the solution is easy as I've been staring at this entirely too long. Am I just trying to put too many points into the digital out? Another potential solution that I'm not entirely sure how to implement, is loading a custom waveform from a file and running that through the waveform generator. Is there an example for that that would also fit with the DAQ needs? Cheers, Brian AnalogIn_Acquisition_5.py