• 0
Sign in to follow this  
holla2040

AnalogIn_Trigger.py source question

Question

Folks,

I'm looking at data from the example code, AnalogIn_Trigger.py. I made it simpler by removing the average loop, now just prints a single post-trigger dataset. 

I have the following

1KHz 2Vrms attached to ch1

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(1.20)) # 1.2V
dwf.FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive)

when I print acquired data, I would expect the dataset[0] to start just above the triggerlevelset of 1.2v. My results are all over the place, here's output from 2 runs

DWF Version: 3.5.4
Opening first device
Preparing to read sample...
1.5915261256
1.5915261256
1.5911919716
1.58952120157
1.58918704757
1.58785043155
1.58818458555
1.58551135352
1.58684796954
1.58517719951

DWF Version: 3.5.4
Opening first device
Preparing to read sample...
0.778195278362
0.779197740376
0.779197740376
0.780534356395
0.780534356395
0.782873434427
0.783541742436
0.784878358455
0.784878358455
0.785212512459
 

Any ideas? I've attached my code.

Thanks,
Craig


 

AnalogIn_Trigger.py

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

OK, I was looking at my same signal's data arrat in waveforms. I think the center value of the returned data array is the trigger point value. Is this true?  If this is the case, how is the timestamp for data array values computed or acquired? Thanks.

Share this post


Link to post
Share on other sites
  • 0

I discovered that calling dwf.FDwfAnalogInReset before I setup or acquired data was affecting the trigger performance. Removed that and the middle point in my array is now near the trigger level.

Now my problem is trigger.condition = trigcondRisingPositive isn't consistent. I get both rising and falling values at the array mid-point. 

Share this post


Link to post
Share on other sites
  • 0

OK, I got it. I had to set FDwfAnalogInTriggerHysteresisSet to 0.01, this fixes the rise/fall inconsistency issue.  

Digilent, please add 

dwf.FDwfAnalogInTriggerHysteresisSet(hdwf,c_double(0.01))

to AnalogIn_Trigger.py example

 

Share this post


Link to post
Share on other sites
  • 0

Thanks for reading all these, I figured out a lot in this single acq mode configuration.

from the sdk doc, FDwfAnalogInTriggerPositionInfo returns the minimum and maximum values of the trigger position in seconds. The horizontal trigger position is used for Single acquisition mode and it is relative to the buffer middle point. From a GUI perspective I can see why this important, pre and post trigger data display. From a data analysis perspective this a little messy to figure out the position value exactly such that only post-trigger data is returned. Or is it?  I mess around and post here with the solution. 

 

Share this post


Link to post
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
Sign in to follow this