Jump to content

Robert White

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by Robert White

  1. I think I fixed my instability problem. It seems sometimes I was starting the wavegen output a little too early and the scope wasn't yet ready to trigger. I added this chunk of code before starting the wavegen and it now appears to work every time. dwf.FDwfAnalogOutNodeDataSet(hdwf, c_int(0), AnalogOutNodeCarrier, rgdSamples, c_int(cSamples)) #upload waveform data to buffer #Adding this wait seems to solve stability problems. while True: #wait for acquisition to be ready dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) if sts.value == DwfStateArmed.value : break time.sleep(0.001) #This is needed too: time.sleep(0.001) #enable wavegen (send out waveform) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1))
  2. Thanks - yes - I have a number of lines setting up the scope which I left out of the code to try to keep it shorter ... here they are: # initialize the oscilloscope # capture up to 32Ki samples nBufMax = c_int() dwf.FDwfAnalogInBufferSizeInfo(hdwf, 0, byref(nBufMax)) nSamples = min(NumSamples, nBufMax.value) rg0 = (c_ushort*nSamples)() #analog measurement array chan0 rg1 = (c_ushort*nSamples)() #analog measurement array chan1 #set up acquisition SampleRate=c_double(Fs) dwf.FDwfAnalogInFrequencySet(hdwf,SampleRate) dwf.FDwfAnalogInBufferSizeSet(hdwf, nSamples) dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_int(1)) #channel 0 enable dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(1), c_int(1)) #channel 1 enable dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(Range0)) # Chan 0 range Vpk2pk dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(0), c_double(Offset0)) #Chan 0 Offset (V) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(1), c_double(Range1)) # Chan 1 range Vpk2pk dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(1), c_double(Offset1)) #Chan 1 Offset (V) Maybe the problem is what you mention about the delay for capturing pre-trigger samples ... I'll try putting a couple of delays in. My intention is to capture starting at the same time the analog out waveform starts with the lines: #Set up scope to trigger on analog out dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcAnalogOut1) # trigger scope on analog-out 1 start dwf.FDwfAnalogInTriggerPositionSet(hdwf, c_double(cSamples/Fs/2)) # T0 on left, trigger the first sample
  3. @attila OK ... so ... something like this? I'm looping, changing the buffer on the wavegen in each loop iteration, and then reading data in on the scope. This will work for some number of iterations (mabye a 100 maybe more) but then it will get stuck ... the loop will keep running but the result returned from the scope will always be the same - its like it didn't have time to trigger or something ... it's not repeatable ... sometimes it will work for a number of iterations and then get into the state where the scope buffer is always the same ... Are my AutoConfigureSet() and AnalogOutConfigure() functions looking right?? Thank you!! #Set AutoConfigure Off dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) #Set up scope to trigger on analog out dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcAnalogOut1) # trigger scope on analog-out 1 start dwf.FDwfAnalogInTriggerPositionSet(hdwf, c_double(cSamples/Fs/2)) # T0 on left, trigger the first sample #set up the waveform generator dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(1)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcCustom) #set custom waveform dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(hzFreq)) #set buffer length (repeat rate) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(drive_amp)) #amplitude in volts dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), c_double(1.0/hzFreq)) # run for 1 period dwf.FDwfAnalogOutWaitSet(hdwf, c_int(0), c_double(1.0/hzFreq)) # wait one pulse time dwf.FDwfAnalogOutRepeatSet(hdwf, c_int(0), c_int(1)) # repeat 1 times for n in range(1,1000) #Calculate new cSamples #Load samples into output buffer dwf.FDwfAnalogOutNodeDataSet(hdwf, c_int(0), AnalogOutNodeCarrier, rgdSamples, c_int(cSamples)) #upload waveform data to buffer #enable wavegen and send out waveform dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1)) while True: #wait for acquisition to be ready (should trigger automatically on analog out start) dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) if sts.value == DwfStateDone.value : break time.sleep(0.001) #disable wavegen ready for next buffer (not sure this is needed, trying to get buffer updates to be stable) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(0)) dwf.FDwfAnalogInStatusData16(hdwf, c_int(0), rg0, c_int(0), len(rg0)) # get channel 0 data, start from sample 0
  4. @attilaI'm getting some unstable / not repeatable results when using custom analog output on the ADP3250 and wondered if it might be related to these commands *Configure *ConfigureSet which I don't quite understand. This is the relevant portion of my code ... do I need to be putting some FDwfAnalogOutConfigure(hdwf, 3 or 0 or 1) things in there somewhere? Where? I don't understand what those commands are doing "stop" "start" "dynamic" ?? Thank you!! #I don't know what this does but many examples have it: # 0 = the device will be configured only when calling FDwf?Configure # dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) #set up the waveform generator dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(1)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcCustom) #set custom waveform dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(hzFreq)) #set buffer length (repeat rate) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(drive_amp)) #amplitude in volts dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), c_double(1.0/hzFreq)) # run for 1 period dwf.FDwfAnalogOutWaitSet(hdwf, c_int(0), c_double(1.0/hzFreq)) # wait one pulse time dwf.FDwfAnalogOutRepeatSet(hdwf, c_int(0), c_int(1)) # repeat 1 times #Load samples into output buffer dwf.FDwfAnalogOutNodeDataSet(hdwf, c_int(0), AnalogOutNodeCarrier, rgdSamples, c_int(cSamples)) #upload waveform data to buffer # send out waveform dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1))
  5. I found my error - FDwfAnalogInStatusData16 has an extra argument when compared to dwf.FDwfAnalogInStatusData. Have to specify the starting sample. SO I just needed to add another c_int(0) dwf.FDwfAnalogInStatusData16(hdwf, c_int(0), c_int(0), rg, len(rg)) # get channel 1 data Now it works.
  6. Hi - I'm using ADP3250 in linux mode with most recent Waveforms SDK and python3. Things are working great. I want to write binary data to flash memory quickly. I had my code working with the FDwfAnalogInStatusData function, but that was writing doubles (8 bytes?) for each sample, I thought it would be a little faster, and make smaller files, with no loss of precision if I had it write only the "raw" uint16 (2 bytes) per sample. SO I tried the FDwfAnalogInStatusData16 function. However the binary file contains only "null". The code worked fine when using FDwfAnalogInStatusData, only changes were to change to FDwfAnalogInStatusData16 and change the type of the buffer array from c_double to c_uint16 Any ideas?? Thanks! from ctypes import * from dwfconstants import * from subprocess import call import sys import time dwf = cdll.LoadLibrary("libdwf.so") hdwf = c_int() # device handle rg = (c_uint16*nSamples)() #analog measurements # open device dwf.FDwfDeviceOpen(c_int(0), byref(hdwf)) # open first device #I don't know what this does but many examples have it: # 0 = the device will be configured only when calling FDwf?Configure dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) #set up acquisition nSamples = 32768 SampleRate=c_double(5000000) dwf.FDwfAnalogInFrequencySet(hdwf,SampleRate) dwf.FDwfAnalogInBufferSizeSet(hdwf, nSamples) dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_int(1)) #channel 1 enable dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(1), c_double(4)) # 4V pk2pk time.sleep(2) # wait at least 2 seconds for the offset to stabilize after the first connection dwf.FDwfAnalogInConfigure(hdwf, c_int(1), c_int(1)) #Update config and enable writefile_binary=open(filename_data,'wb') dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) while True: dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) if sts.value == DwfStateDone.value : break time.sleep(0.001) dwf.FDwfAnalogInStatusData16(hdwf, c_int(0), rg, len(rg)) # get channel 1 data writefile_binary.write(rg) writefile_binary.close() dwf.FDwfAnalogInStatusData16(hdwf, c_int(0), rg, len(rg)) # get channel 1 data writefile_binary.write(rg)
  7. I am new to this product line but so far I am finding it very useful. The linux mode seems very useful to me - I plan to deploy systems for environmental measurement using ultrasound, and the ability to easily program the system to autonomously collect data (with no connection to a PC or even needing a separate raspberry pi or something) and write to the local flash memory or a USB flash is extremely helpful.
  8. Thank you @attila and @Lloyd Parkes. Adding the line dwf.FDwfAnalogIOStatus(hdwf) #read the Analog IO status before reading the temperature was all that was required. Temperature is now reading around 50 C which seems reasonable. I have seen lots of references to the pydwf package which @Lloyd Parkes suggests, I will have to decide whether to stick with the c_type() stuff or install that. Thank you!! Great stuff!!
  9. Hi, New to the ADP3250 and so far very impressed at the capabilities and trying to learn how to program my applications up in linux mode. I'm trying to read the IO status register "temperature" which I think is channel 1, node 0, see table below. Using linux mode and running a python script. I keep getting "0" for the temperature. I feel like I'm not enabling the device correctly or somehow not understanding how to read the Status? Help? from ctypes import * from dwfconstants import * from subprocess import call import sys dwf = cdll.LoadLibrary("libdwf.so") hdwf = c_int() # device handle dwf.FDwfDeviceOpen(c_int(0), byref(hdwf)) # open first device T1=c_int() dwf.FDwfAnalogIOChannelNodeStatus(hdwf, c_int(1), c_int(0), byref(T1)) temp_internal=str(round(T1.value,3)) print(temp_internal)
  10. I think I found something. https://www.bixpower.com/product-p/dc36t19v-6a.htm I'll give it a try!
  11. Hmm. Thanks for the answers. I'm feeling stuck. 19V adapters for laptop use AC power from the wall ... 110/220Vac ... but I'll be on a remote platform with only DC power available at 28V or something like that ... any ideas anyone? Need a box to convert 28-34V-ish DC power to 19V +/-0.8V ...
  12. Not a lot of DC DC converter options that output 19V ... will it die if I feed it 24V ... anyone know of a DC DC converter that puts out 19V? I found this thing but its kind of big (3 lbs, 30 cm long) https://www.powerstream.com/dc-buck-boost.htm Couldn't find anything on Mouser or Digikey
  13. Thanks @attila. Not a very wide range ... I'll try to find something ...
  14. I want to run the Analog Discovery Pro 3000 off of a battery pack. Input is 19V which is an awkward value. I can't find any acceptable range in the documentation. 18-24V? 15-30V? What is ok? Thanks!
×
×
  • Create New...