menach_g

Members
  • Content Count

    5
  • Joined

  • Last visited

  1. solved: the problem was made when syncing with a clock and nSamples bigger than clock cycles. solution: adding exit condition in acquire loop, using FDwfDigitalOutStatus to check if output is done
  2. hey @attila thanks for all the great help I got the custom output setup fully working for my implemntation but now I want to add digitaln reading back using din pins I want the recording to be in sync with one of the io output channels which is a clock I got working in wf program like so: but when I did not find the equivalent functions in the sdk documentation I tried using snippets of code from "DigitalIn_Sync.py" nut it just goes into infinite loop with "cAvailable.value" == 0 every time..(I would add my code here but some parts like the custom setup are too long for simple code snippets) do you know how to set up a simple input in sync with custom output in python sdk your help will be greatly appreciated!!
  3. yes it works for 1.2v thank you very much! and I need to output more complicated signals than a simple clock do you know of a way to input the custom data as bit list and not byte list?(yes I know I can add a function to format it that way nut I want to avoid that as I'm dealing with long signals)
  4. thank you very much I finally got it working since then using the example "DigitalOut_Pins.py" do you know if there is a way to input custom data not in byte list format but as a list of bits? also I can't seem to find a command to set the output volatge like in wf program? I tried "FDwfAnalogImpedanceAmplitudeSet" which is the closest thing I found, but it doesn't change the output volatge. I need it to be set to 1.2v instead of 3.3v. thnks for the help!
  5. I'm trying to use output a custom pattern contained in csv format out of a digital discovery. I succeeded doing so using the program and adding manually, now I want to do this in python using the sdk. I can see the function I need to use is "FDwfDigitalOutDataSet" but I don't seem to get it working. the only example on custom data is on the analog discovery and it doesn't seem to be the same. here is the code I try running from ctypes import * from dwfconstants import * import math import time import matplotlib.pyplot as plt import sys dwf = cdll.dwf hdwf = c_int() sts = c_byte() version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: " + str(version.value)) print("Opening first device") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) if hdwf.value == 0: print("failed to open device") szerr = create_string_buffer(512) dwf.FDwfGetLastErrorMsg(szerr) print(str(szerr.value)) quit() hzSys = c_double() dwf.FDwfDigitalOutInternalClockInfo(hdwf, byref(hzSys)) print("Internal frequency is " + str(hzSys.value / 1e6) + " MHz") # 100kHz counter rate, SystemFrequency/100kHz cntFreq = c_uint(int(hzSys.value / 10e6)) data_py=[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1] data=(c_int*len(data_py))() # for i in range(0,len(data)): # data[i] = 1.0*i/len(data_py); for i in range(len(data_py)): data[i]=c_int( data_py[i]) pin=0 # generate pattern dwf.FDwfDigitalOutEnableSet(hdwf, c_int(pin), c_int(1)) dwf.FDwfDigitalOutOutputSet(hdwf, c_int(pin),c_int(3)) dwf.FDwfDigitalOutDataSet(hdwf,c_int(pin),data,c_int(len(data))) dwf.FDwfDigitalOutConfigure(hdwf, c_int(pin),c_int(1)) print("Generating pattern...") time.sleep(10) dwf.FDwfDigitalOutReset(hdwf) dwf.FDwfDeviceCloseAll() if anyone have an example of a working patterns code using custom pattern is would be much appreciated