Jump to content

abia

Members
  • Posts

    7
  • Joined

  • Last visited

abia's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. I am trying to control the 5250s AWG with the python sdk, i know with the AD2 the wavegen pin isnt actaully used for this but instead a dio pin is. Because the ADP5250 py SDK doesnt support digital out, does that mean you cant use its wavegen in py?
  2. data_py = [0 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0 1 0 1 1] #print(data_py) dwf.FDwfDigitalOutInternalClockInfo(hdwf, byref(hzSys)) # how many bytes we need to fit this many bits, (+7)/8 rgbdata = (c_ubyte * ((len(data_py) + 7) >> 3))(0) # array to bits in byte array for i in range(len(data_py)): if data_py[i] != 0: rgbdata[i >> 3] |= 1 << (i & 7) pin = 2 dwf.FDwfDigitalOutDataSet(hdwf, c_int(pin), byref(rgbdata), c_int(len(data_py))) #print("Writing...") dwf.FDwfDigitalOutConfigure(hdwf, c_int(1)) time.sleep(1) dwf.FDwfDigitalOutConfigure(hdwf, False) I've been playing around with the time.sleep but that's definitely not gonna be precise enough. Most of the above is sample code i believe from custom digital out.
  3. Below works on AD2 but im trying to control supplies in the scripts for ADP5250, what needs to be changed? open("Supplies") Supplies.Output.PositiveSupply.Voltage.value=3 Supplies.Output.NegativeSupply.Voltage.value=-5 Supplies.Output.PositiveSupply.Enable.value=1 Supplies.Output.NegativeSupply.Enable.value=1 Supplies.run()
  4. @Mina Sameh Hey mina Im trying to do the same thing here, measure the freq of input signal through python sdk. Did u have any luck? I checked the spectrum analyzer link thats in this thread but couldn't seem to figure it out.
  5. Hey Attila! Thanks for getting back so fast. So Im trying out those two samples but I dont see where either of those utilize a get frequency function. Is there an analoginfrequencyget() function of sorts? and if not any recommendations on how to get the real time frequency of an input signal to the oscilloscope? Thanks so much
  6. my external wavegenerator is set to sine wave 2kHz with High 700mV and low 0mV. im trying to record the frequency through the ad2 osciloscope (analog in). but my output displays '0' from ctypes import * from dwfconstants import * import time import sys 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() voltage1 = c_double() voltage2 = c_double() #print(DWF version version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: "+str(version.value)) #open device "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) print("failed to open device") quit() print("Preparing to read sample...") dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(0), c_double(0)) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) dwf.FDwfAnalogInConfigure(hdwf, c_bool(False), c_bool(False)) time.sleep(2) z = 0 for i in range(4): time.sleep(1.66) dwf.FDwfAnalogInStatus(hdwf, False, None) dwf.FDwfAnalogInStatusSample(hdwf, c_int(0), byref(voltage1)) dwf.FDwfAnalogInStatusSample(hdwf, c_int(1), byref(voltage2)) print("Channel 1: " + str(voltage1.value)+" V") print("Channel 2: " + str(voltage2.value)+" V") dwf.FDwfAnalogInFrequencyGet(hdwf, z) print("Freq: " + str(z) ) print('---------------------------') dwf.FDwfDeviceCloseAll() ##### DWF Version: b'3.18.1' Preparing to read sample... Channel 1: 0.25451508173897247 V Channel 2: -0.0023014079845233293 V Freq: 0 --------------------------- Channel 1: 0.44609468785736645 V Channel 2: 0.012614214611239793 V Freq: 0 --------------------------- Channel 1: 0.6771269877313809 V Channel 2: 0.012614214611239793 V Freq: 0 --------------------------- Channel 1: 0.05825464754787773 V Channel 2: 0.027529837207002916 V Freq: 0 --------------------------- Process finished with exit code 0
×
×
  • Create New...