Jump to content

jiw

Members
  • Posts

    6
  • Joined

  • Last visited

jiw's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. I'd love to see a bit more bandwidth personally. I really like the analog discovery 2, the software is just great. I always go for it first if I am looking at something less than 20 mhz.
  2. Ok I got it, the issue is I had to change FDwfAnalogOutTriggerSourceSet to this: dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(-1), trigsrcAnalogIn) So the full code looks like: #set up acquisition dwf.FDwfAnalogInFrequencySet(hdwf, c_double(20000000.0)) dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(8192)) dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) #set up trigger dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(0)) # disable auto trigger dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorAnalogIn) # one of the analog in channels dwf.FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge) dwf.FDwfAnalogInTriggerChannelSet(hdwf, c_int(0)) # first channel dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(0.5)) # 0.5V dwf.FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive) print("Getting sine wave ready...") # AWG 1 carrier dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), c_int(0), c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), c_int(0), funcSine) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), c_int(0), c_double(freq_test[0])) dwf.FDwfAnalogOutNodeOffsetSet(hdwf, c_int(0), c_int(0), c_double(0.0)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), c_int(0), c_double(.09)) dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(-1), trigsrcAnalogIn) # dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), 3) dwf.FDwfAnalogInConfigure(hdwf, c_bool(False), c_bool(True)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) for iTrigger in range(len(freq_test)): # reg_ack.write_reg(0x0, 0x1) # new acquisition is started automatically after done state while True: dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) # print(sts.value == DwfStateArmed.value) if sts.value == DwfStateDone.value: print("Triggered") freq_test_index += 1 time.sleep(3) dwf.FDwfAnalogOutReset(hdwf) time.sleep(1) dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), c_int(0), c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), c_int(0), funcSine) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), c_int(0), c_double(freq_test[iTrigger])) dwf.FDwfAnalogOutNodeOffsetSet(hdwf, c_int(0), c_int(0), c_double(0.0)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), c_int(0), c_double(.09)) dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(-1), trigsrcAnalogIn) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) # dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), 3) time.sleep(2) break Second part of the code shows to switch to the next frequency after the trigger. Change it to your liking.
  3. I tried using the SDK, basically I want the analog in to act as the trigger signal to start the analog output wave generator. However the output starts immediately, before the trigger. #set up acquisition dwf.FDwfAnalogInFrequencySet(hdwf, c_double(20000000.0)) dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(8192)) dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) #set up trigger dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(0)) # disable auto trigger dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorAnalogIn) # one of the analog in channels dwf.FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge) dwf.FDwfAnalogInTriggerChannelSet(hdwf, c_int(0)) # first channel dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(0.5)) # 0.5V dwf.FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive) print("Getting sine wave ready...") # AWG 1 carrier dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), c_int(0), c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), c_int(0), funcSine) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), c_int(0), c_double(freq_test[0])) dwf.FDwfAnalogOutNodeOffsetSet(hdwf, c_int(0), c_int(0), c_double(0.0)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), c_int(0), c_double(.09)) dwf.FDwfAnalogOutTriggerSourceSet(hdwf, trigsrcAnalogIn) dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), 3) dwf.FDwfAnalogInConfigure(hdwf, c_bool(False), c_bool(True)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) # wait at least 2 seconds with Analog Discovery for the offset to stabilize, before the first reading after device open or offset/range change time.sleep(2)
  4. Hi, So I want to create a script that sets the wavegen mode to trigger. Then I want it move to the next frequency (and turn off output), then move onto a new frequency and wait for a trigger. So basically: 1. Set wavegen to sine wave at 1khz 2. Wait for a trigger 3. Output sinewave for a few seconds 4. Set sinewave to 10khz 5. Wait for trigger 6. Output sinewave for a few seconds What's the best way of doing this? I'm having a tough time finding examples. I don't know how to set the wavegen to trigger mode from the script editor or how to create a list of frequencies to cycle through. Thanks
×
×
  • Create New...