Hi. I am trying to sync two AD3's using waveforms SDK. I want to use an external trigger to start the digital clock signal on both devices. My issue right now is that when I call dwf.FDwfDigitalOutConfigure() the clock signal starts without waiting for a trigger. I'm sure there is a way to do this, but I can't figure it out. I have been looking at the example python files and that is how I got to this point. Here is my code so far. Any suggestions?
from ctypes import*import sys
import time
from dwfconstants import*# Load the WaveForms library
dwf = cdll.dwf
# Print DWF version
version = create_string_buffer(16)
dwf.FDwfGetVersion(version)print("DWF Version: "+ version.value.decode())
cDevice = c_int()
dwf.FDwfEnum(c_int(0), byref(cDevice))print("Found "+ str(cDevice.value)+" devices")
cChannel =2
cOutput = cDevice.value * cChannel
hdwf = c_int()# Open devicefor iDevice in range(cDevice.value):
dwf.FDwfDeviceOpen(c_int(iDevice), byref(hdwf))print(f"Configure Device {iDevice +1}")if hdwf.value ==0:print("Failed to open device")
sys.exit(1)for iChannel in range(cChannel):# enable output for DIO 0
dwf.FDwfDigitalIOOutputEnableSet(hdwf, c_int(0x0002))# 1<<1# set value on enabled IO pins
dwf.FDwfDigitalIOOutputSet(hdwf, c_int(0x0000))# DIO-0 low# configure and start clock
hzSys = c_double()
dwf.FDwfDigitalOutInternalClockInfo(hdwf, byref(hzSys))
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(0), c_int(1))# 1kHz pulse on DIO-0
dwf.FDwfDigitalOutDividerSet(hdwf, c_int(0), c_int(int(hzSys.value /1e4/2)))# prescaler to 2kHz, SystemFrequency/1kHz/2
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(0), c_int(1), c_int(1))# 1 tick low, 1 tick high
dwf.FDwfDigitalOutRepeatTriggerSet(hdwf, c_int())
dwf.FDwfDigitalOutTriggerSourceSet(hdwf, c_int(0), trigsrcExternal1)# Start the channel, this will wait for the trigger
dwf.FDwfDigitalOutConfigure(hdwf)# Configure Trigger-1 pin to output the triggerPC signal for the last device
dwf.FDwfDeviceTriggerSet(hdwf, c_int(2), c_byte(1))# 1 = trigsrcPC# After open, before the first run wait a bit for the offsets to stabilize
time.sleep(5)print("Pulse trigger to start generation...")
dwf.FDwfDeviceTriggerPC(hdwf)
time.sleep(5)print("Done.")
dwf.FDwfDeviceCloseAll()
Question
Maxpfeiff
Hi. I am trying to sync two AD3's using waveforms SDK. I want to use an external trigger to start the digital clock signal on both devices. My issue right now is that when I call dwf.FDwfDigitalOutConfigure() the clock signal starts without waiting for a trigger. I'm sure there is a way to do this, but I can't figure it out. I have been looking at the example python files and that is how I got to this point. Here is my code so far. Any suggestions?
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now