Search the Community

Showing results for tags 'dwf'.

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 2 results

  1. """ DWF Python Example Author: Digilent, Inc. Revision: 2015/02/05 Requires: Python 2.7 Start synchronized the AWG outputs of multiple Analog Discovery devices. Connect the Trigger-1 pin of each device together. """ from ctypes import * import time import sys if sys.platform.startswith("win"): dwf = cdll.dwf elif sys.platform.startswith("darwin"): dwf = cdll.LoadLibrary("libdwf.dylib") else: dwf = cdll.LoadLibrary("") #print DWF version version = create_string_buffer(16) dwf.FDwfGetVersion(version) print "DWF Version: "+version.value cDevice = c_int() dwf.FDwfEnum(c_int(2), byref(cDevice)) # 2 = enumfilterDiscovery print "Found "+str(cDevice.value)+" devices" cChannel = 2 cOutput = cDevice.value*cChannel hdwf = c_int() #open device for iDevice in range (0, cDevice.value): dwf.FDwfDeviceOpen(c_int(iDevice), byref(hdwf)) if hdwf.value == 0: print "failed to open" quit() for iChannel in range (0, cChannel): print "Configure "+str(iDevice+1)+"/"+str(iChannel+1) # enable channel dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(iChannel), c_int(0), c_int(True)) # 0 = AnalogOutNodeCarrier # configure dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(iChannel), c_int(0), c_int(1)) # 1 = funcSine dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(iChannel), c_int(0), c_double(1000.0)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(iChannel), c_int(0), c_double(1.0)) # set trigger source to external trigger 1 dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(iChannel), c_byte(11)); # 11 = trigsrcExternal1 #set different phase iOutput = iDevice*cChannel+iChannel dwf.FDwfAnalogOutNodePhaseSet(hdwf, c_int(iChannel), c_int(0), c_double(360.0*iOutput/cOutput)) # start the channel, this will wait for the trigger dwf.FDwfAnalogOutConfigure(hdwf, c_int(iChannel), c_bool(True)) # configure Trigger-1 pin to output the triggerPC signal for the last device dwf.FDwfDeviceTriggerSet(hdwf, c_int(0), c_byte(1)) # 1 = trigsrcPC # after open, before the first run wait a bit for the offsets to stabilize time.sleep(5) print "Pulse trigger to start generation..." dwf.FDwfDeviceTriggerPC(hdwf); time.sleep(60) print "done." dwf.FDwfDeviceCloseAll()
  2. Hello All, I'm playing around with the "analogout_custom" C sample program that comes with the Waveforms SDK (/usr/share/digilent/waveforms/samples/c/analogout_custom.cpp). I've made some observations that don't align with my expectations. I'm hoping one (or more) of you could kindly offer some insight on what is happening. I'm running on an Ubuntu 16.04 x86-64 machine. I have an Analog Discovery 1 and an Analog Discovery 2 wired such that ad1.aout1 --> ad2.ain1+ ad1.gnd --> ad2.ain1- I'm playing the waveform out through the Analog Discovery 1 and the "analogout_custom" program. I'm capturing the resulting waveform through the Analog Discovery 2 and the Waveforms 2015 oscilloscope. I've attached my Waveforms 2015 oscilloscope configuration file. I've also attached a screenshot of the Waveforms 2015 oscilloscope showing the results of two runs of "analogout_custom". Channel 1 (yellow) displays the waveform produced by my most recent run of "analogout_custom". Reference 1 (gray) displays a waveform that was captured on Channel 1 during a prior invocation of "analogout_custom" and saved off as a reference waveform. Expectations: 1) A waveform consisting of 4096 samples played at 10 kHz should have a duration of ~0.5 seconds. 2) The waveform should play once, given the default of AnalogOutRepeat = 1. 3) The waveform should begin playing at the first sample, which always has the same value. 4) The generated waveform should be consistent for all invocations of "analogout_custom". Unexpected observations: 1) The waveform has a duration of ~1.8 seconds, as highlighted by the cursors' delta X in the oscilloscope screenshot. 2) The waveform plays more than once, as indicated by the multiple peaks on the yellow waveform in the oscilloscope screenshot. 3) The waveform does not begin playing at the first sample, as indicated by the different values at x=0 for the yellow and gray waveforms. 4) The played waveform is not consistent between invocations, as indicated by the yellow and gray waveforms not aligning. Here's the "analogout_custom.cpp" source code for your convenience: #include "sample.h" int main(int carg, char **szarg){ HDWF hdwf; double rgdSamples[4096]; char szError[512] = {0}; // generate custom samples normalized to +-1 for(int i = 0; i < 4096; i++) rgdSamples = 2.0*i/4095-1; printf("Open automatically the first available device\n"); if(!FDwfDeviceOpen(-1, &hdwf)) { FDwfGetLastErrorMsg(szError); printf("Device open failed\n\t%s", szError); return 0; } printf("Generating custom waveform for 5 seconds..."); // enable first channel FDwfAnalogOutNodeEnableSet(hdwf, 0, AnalogOutNodeCarrier, true); // set custom function FDwfAnalogOutNodeFunctionSet(hdwf, 0, AnalogOutNodeCarrier, funcCustom); // set custom waveform samples // normalized to ±1 values FDwfAnalogOutNodeDataSet(hdwf, 0, AnalogOutNodeCarrier, rgdSamples, 4096); // 10kHz waveform frequency FDwfAnalogOutNodeFrequencySet(hdwf, 0, AnalogOutNodeCarrier, 10000.0); // 2V amplitude, 4V pk2pk, for sample value -1 will output -2V, for 1 +2V FDwfAnalogOutNodeAmplitudeSet(hdwf, 0, AnalogOutNodeCarrier, 2); // by default the offset is 0V // start signal generation FDwfAnalogOutConfigure(hdwf, 0, true); // it will run until stopped or device closed Wait(5); printf("done\n"); // on close device is stopped and configuration lost FDwfDeviceCloseAll(); } Thanks in advance! Chris (This is a repost. Original post somehow ended up in Home > Digilent Technical Forums > Scopes & Instruments > WaveForms Live and OpenScope feedback.) analogout_custom.dwf3scope