Jump to content
  • 0

triggerIn


Hobs

Question

Hello I work in a research laboratory and I am a beginner in programming. I have an ADP3450 that I would like to program in python with pyQt5. In my digilent5 code I would like to use channel 1 of my ADP3450 to trigger at 1Volt for example. I know I have to use the following functions "#dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, ctypes.c_double(0)); dwf.FDwfAnalogInTriggerSourceSet(hdwf, None); dwf.FDwfAnalogInTriggerChannelSet(hdwf, ctypes.c_int(2)) ; dwf.FDwfAnalogInTriggerTypeSet(hdwf, constants.trigtypeEdge); dwf.FDwfAnalogInTriggerLevelSet(hdwf, ctypes.c_double(1)); dwf.FDwfAnalogInTriggerConditionSet(hdwf, constants.trigcondRisingPositive)" but I can't use them correctly. My ADP3450 does not trig. Could you help me. I work on linux (armbian) but on windows it's the same it doesn't work better.  Could you please help me. I thank you all very much in advance.

 

digilent5.py

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Hello I thank you very much for this very useful information for me. Indeed it works well. I also have a second more theoretical question. I would like to use the adp3450 in XY mode with python. The four analog channels on the Y axis and one or two analog outputs (wavegen out) for the X axis. Is it possible to get the theoretical value of the wavegen output via the usb? Or I have to sacrifice an analog input to do the X. I would have only 3 Y and not 4 Y. I thank you in advance

 

Link to comment
Share on other sites

  • 0

Hi @Hobs

Theoretical value of analog-out is not available.
The most accurate would using one scope channel to capture it with precise timing (, attenuation...) relative to the other signals.
If you are using stable trigger (like analog-out triggered on analog-in), this can be saved in you script and used as 'reference' for X in the consecutive captures.
You could also generate the theoretical value with a script function, like a 'math' channel.

image.png

Link to comment
Share on other sites

  • 0

I'm sorry to ask you to do this, but I would like to use the DIO to trigger a script. I can easily use the pattern to emit a 3V signal and trigger a relay but I can't correctly read a high state on an input. I would like to apply (with a GBF) 3V DC to a digital input of my choice to read this input. If the input (e.g. pin 0) is zero then 0V is indicated if the input is 3V print high. This product ADP3450 is very advantageous for us but I need to master it. I would like to make an automatic laser relock script. To keep one of our lasers locked at the right frequency. I would like to thank you very much in advance for your feedback and advice.

Link to comment
Share on other sites

  • 0

Good morning, sir. I would like to use python to tell me if the DIO.0 input is high or low. I am sending a 3V signal to the DIO.0 input. With the waveform program it works perfectly. I can read the value of the input correctly depending on what I input as a signal. But with python it is impossible to read this value. I have taken scripts on the forum to try to understand but nothing works, the input read remains at zero. Can you help me ? I just want python to print value high state when there is 3V low state when there is 0V. Thank you in advance

# import constants
path.append(constants_path)
import dwfconstants as constants

hdwf = c_int()
hzDI = c_double()
#sts = c_byte()

cSamples = 1000

dwf.FDwfDigitalInInternalClockInfo(hdwf, hzDI)
dwf.FDwfDigitalInTriggerSourceSet(hdwf, constants.trigsrcDetectorDigitalIn)
#dwf.FDwfDigitalInTriggerSet(hdwf, 0, 0, 0, '&HFFFF')
dwf.FDwfDigitalInTriggerAutoTimeoutSet(hdwf, 10)
dwf.FDwfDigitalInDividerSet(hdwf, c_int(1000))
dwf.FDwfDigitalInSampleFormatSet(hdwf, 8)
dwf.FDwfDigitalInBufferSizeSet(hdwf, cSamples)
dwf.FDwfDigitalInTriggerPositionSet(hdwf, cSamples - 10)


# begin acquisition
dwf.FDwfDigitalInConfigure(hdwf, c_bool(0), c_bool(1))
print ("waiting to finish")

i = 0
while i < 10:
    sts = ctypes.c_byte()
    dwf.FDwfDigitalInStatus(hdwf, c_int(0), byref(sts))
    print ("STS VAL: " + str(sts.value))
    if (sts.value == stsDone.value):
        break
    time.sleep(1)
    i=i+1
print ("Acquisition finished")

time.sleep(1)

dwf.FDwfDigitalOutReset(hdwf)
dwf.FDwfDeviceCloseAll()


rgpy=[0.0]*len(rgwSamples)
for i in range(0,len(rgpy)):
    rgpy[i]=rgwSamples[i]

plt.plot(rgpy)
plt.show()

Link to comment
Share on other sites

  • 0

I just understood. I had already seen this example but I didn't understand. There has to be a white space between (hdwf) and dwf.FDwfDigitalIOStatus. I feel stupid. It works fine. Beginner's mistake. Sorry for the inconvenience.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...