Hello,
I am using below code to generate a Negative pulse at regular interval on DIO 0 pin of AD2
---------------------------------------------------------
print("Generating 1s pulse")
while True:
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(0), c_int(1))
dwf.FDwfDigitalOutRunSet(hdwf, c_double(0.05)) # 50ms run
dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(1)) # once
dwf.FDwfDigitalOutIdleSet(hdwf, c_int(0), c_int(1)) # 1=DwfDigitalOutIdleLow, low when not running
dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(0), c_int(1), c_int(0)) # initialize high on start
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(0), c_int(0), c_int(0)) # low/high count zero, no toggle during run
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
time.sleep(0.1)
dwf.FDwfDigitalOutReset(hdwf)
time.sleep(5)
dwf.FDwfDigitalOutReset(hdwf)
dwf.FDwfDeviceCloseAll()
--------------------------------------------------------
And after this code segment I have another "pulse acquisition" code from Different pins of Digilent.
==> But, Since i ran code above continously in while loop(we need to generate the pulse continously), the acquisition code is not getting executed.
Need some idea here, if we can ran the pulse generation with some other way or configure digilent.
Any help is appreciated. @attila
#############
Tried Below code to configure digilent for pulse generation but No Luck so far:
------------
# continue running after device close
dwf.FDwfParamSet(c_int(4), c_int(0)) # DwfParamOnClose 0 = run, 1 = stop, 2 = shutdown
print("Opening first device")
hdwf = c_int()
dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf))
# the device will be configured only when calling FDwf###Configure
dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0))
# digital output
dwf.FDwfDigitalOutTriggerSourceSet(hdwf, c_int(3)) # trigsrcDetectorDigitalIn
dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(0)) # infinite repeat
dwf.FDwfDigitalOutRepeatTriggerSet(hdwf, c_int(1)) # wait for trigger in each cycle
dwf.FDwfDigitalOutRunSet(hdwf, c_double(1)) # 1ms run
# DIO 1 pulse
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(1), c_int(1))
dwf.FDwfDigitalOutIdleSet(hdwf, c_int(1), c_int(1)) # 1=DwfDigitalOutIdleLow, low when not running
dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(1), c_int(1), c_int(0)) # initialize with high when running
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(1), c_int(0), c_int(0)) # low/high count zero, no toggle during run
# configure and start
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
------------
Thanks,
Rohit