Jump to content

Pedro Vaz

Members
  • Posts

    1
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Pedro Vaz's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. Hi All. Sorry but this will be a long question and I will start with some context. I want to perform a triggered acquisition of a finite (and small) number of samples for each trigger. This looks very simple task and I was able to do it but I am struggling with some performance issues. The problem is the following: I have two electrical signals, a digital trigger and the actual analog signal that I want to acquired. The trigger comes in groups of 24. See figure to check the structure of both signals. I want to acquired a small portion of the signal for each trigger falling edge. The analog signal is connected to channel 1 and the trigger is currently connected to channel 2 (I have also tried to connect it to the T1 pin of the AD2 but that did not make any difference). the time interval 2 (T2) is fixed and is 250 usec. Time interval 3 (T3) is about 125 usec but this can be changed. Time interval one (T1) is the actually problem. Now I can acquire the signals with T1 larger than 5 ms without any problem. Less than that and the AD2 starts missing some triggers. I want to reduce this T1 to about 1 ms or 0.5 ms. I'm configuring the diligent using the Python API and performing a reading after each trigger. Simplified code configuration below: nsamples = 256 hzAcq = 2000000 #set up acquisition dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) dwf.FDwfAnalogInAcquisitionModeSet(hdwf, c_int(0)) # Single dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq) sRecord = (nSamples/2)/hzAcq.value dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(nSamples)) dwf.FDwfAnalogInTriggerPositionSet(hdwf, c_double(0)) dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) #set up trigger dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(3)) #trigger timeout 3 seconds dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorAnalogIn) # 2 - Trigger on Channel In. dwf.FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge) # trigtypeEdge dwf.FDwfAnalogInTriggerChannelSet(hdwf, c_int(1)) # Channel 2 dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(0.5)) # LevelSet only works when the trigger is on the acquisition channel. dwf.FDwfAnalogInTriggerConditionSet(hdwf, trigcondFallingNegative) # trigconNegativeEdge for iTrigger in range(0, 24): while True: dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) if sts.value == DwfStateDone.value: break dwf.FDwfAnalogInStatusData16(hdwf, 0, rgdSamples, 0, nSamples) # get channel 1 data data[iTrigger * nSamples:(iTrigger + 1) * nSamples] = rgdSamples My ideia to solve this problem is to perform only a reading after the 24 triggers. Using some math is should work because I'm acquiring 24*256 samples = 6144, which is less than the AD2 buffer, but I don't know how to do that or even if it is possible. Can you help solving this issue? Is this problem normal or am I doing something wrong? Thank you!
×
×
  • Create New...