Question

Posted (edited)

I am using analog discovery 2. I am trying to acquire data (for 10ms) of first channel from trigger of second channel signal.

this is a part of my code 

hzAcq = c_double(1075000) # 1,075MHz
nSamples =8192

dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) #first signal (channel 1)
dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(1))

dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(1), c_bool(True))#second signal (channel 2)
dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(1), c_double(5))



dwf.FDwfAnalogInAcquisitionModeSet(hdwf, c_int(3)) # record
dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq)
sRecord = nSamples/hdwf.value   # 7.6ms
dwf.FDwfAnalogInRecordLengthSet(hdwf, c_double(sRecord)) # -1 infinite record length
dwf.FDwfAnalogInTriggerPositionSet(hdwf, c_double(-0.25*sRecord)) # -0.25 = trigger at 25%

#set up trigger
dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(10)) # 10 second auto trigger timeout
dwf.FDwfAnalogInTriggerSourceSet(hdwf, c_ubyte(2)) # trigsrcDetectorAnalogIn
dwf.FDwfAnalogInTriggerTypeSet(hdwf, c_int(0)) # trigtypeEdge
dwf.FDwfAnalogInTriggerChannelSet(hdwf, c_int(1)) # channel 2
dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(1.5)) # 1.5V
dwf.FDwfAnalogInTriggerHysteresisSet(hdwf, c_double(0.01)) # 0.01V
dwf.FDwfAnalogInTriggerConditionSet(hdwf, c_int(0)) # trigcondRisingPositive 

the first signal is on mV and the second is a signal on V ( 0-3.3 )

The voltage values that i acquire are not correct. 

Any suggestions?

 

Edited by Kostas

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 1

Hi @Kostas

The maximum recording/streaming rate is around 1MHz. In you original post you had 8MHz.
In case you need 8/16k samples you don't have to do recording, you can perform normal acquisition up to 100MHz.

Instead "sRecord = nSamples/hdwf.value # 7.6ms"  you probably wanted "nSamples/hzAcq.value"

The sample rate can be integral division of base frequency, 100MHz. The following gets the actually configured rate.
hzAcq = c_double(1075000)
nSamples = 8192
dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq)
dwf.FDwfAnalogInFrequencyGet(hdwf, byref(hzAcq))
sRecord = nSamples/hzAcq.value 
print("Rate: "+str(hzAcq.value)+" Length: "+str(sRecord))
# Rate: 1075268.817204301 Length: 0.00761856

This script with AWG1 connected to C2 and having a voltage divider on C1 gives the following result:
AnalogIn_Record2.py

image.png.1db420b960b235ea9e94acaf280ecc6a.png

Share this post


Link to post
Share on other sites
  • 0
16 hours ago, attila said:

Hi @Kostas

The maximum recording/streaming rate is around 1MHz. In you original post you had 8MHz.
In case you need 8/16k samples you don't have to do recording, you can perform normal acquisition up to 100MHz.

Instead "sRecord = nSamples/hdwf.value # 7.6ms"  you probably wanted "nSamples/hzAcq.value"

The sample rate can be integral division of base frequency, 100MHz. The following gets the actually configured rate.
hzAcq = c_double(1075000)
nSamples = 8192
dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq)
dwf.FDwfAnalogInFrequencyGet(hdwf, byref(hzAcq))
sRecord = nSamples/hzAcq.value 
print("Rate: "+str(hzAcq.value)+" Length: "+str(sRecord))
# Rate: 1075268.817204301 Length: 0.00761856

This script with AWG1 connected to C2 and having a voltage divider on C1 gives the following result:
AnalogIn_Record2.py

image.png.1db420b960b235ea9e94acaf280ecc6a.png

Thanks a lot.The code was very helpfull. I would like to ask one more question. The difference between recording and normal acquisition is the FDwfAnalogInAcquisitionModeSet mode(acqmodeRecord-acqmodeScanShift)? Can normal acquisition base on time, not on buffer?

Share this post


Link to post
Share on other sites
  • 0
3 hours ago, attila said:

Hi @Kostas

I was referring with normal to single acquisition mode.

image.png.211fda5752e313761a5e4d49220f65c8.png

This image shows what I am trying to record with waveforms sdk. I used the code that you posted with slight differences but the results are not close to these which I get from waveforms. The device which I am trying to record runs at 8MHz. The sampling rate that I would like to get is 80MHz. Is it possible?  What are the numbers for hdwf, nSamples, dwf.FDwfAnalogInFrequencySet(hdwf, ?), dwf.FDwfAnalogInFrequencyGet(hdwf, byref(?)). I want to record 8ms since trigger starts.

test1.JPG

Share this post


Link to post
Share on other sites
  • 0

Hi @Kostas

It can capture up to 100MHz 8/16k samples with single/repeated acquisition mode or record "unlimited" samples up to ~1MHz.

The sampling rates are integral division of the ADC 100MHz conversion rate. 80MHz not supported, but 100, 50, 33, 25...

You can find the SDK manual and examples on you machine:
image.png
You may also find useful information searching on the forum.

In your screenshot you are triggering on C1 at -100ms and looking at a span of  8ms, the trigger is far out on the right side...
To capture such the scope has to capture more than 100ms span. Due to this you have a very low sample rate.
It would be better to trigger on C2.

image.thumb.png.e8e80d551b05f25597ed38345fc31669.png

Share this post


Link to post
Share on other sites
  • 0
19 hours ago, attila said:

Hi @Kostas

It can capture up to 100MHz 8/16k samples with single/repeated acquisition mode or record "unlimited" samples up to ~1MHz.

The sampling rates are integral division of the ADC 100MHz conversion rate. 80MHz not supported, but 100, 50, 33, 25...

You can find the SDK manual and examples on you machine:
image.png
You may also find useful information searching on the forum.

In your screenshot you are triggering on C1 at -100ms and looking at a span of  8ms, the trigger is far out on the right side...
To capture such the scope has to capture more than 100ms span. Due to this you have a very low sample rate.
It would be better to trigger on C2.

image.thumb.png.e8e80d551b05f25597ed38345fc31669.png

I would like to make a last question. If I want to run the AD2 on 100MHz dwf.FDwfAnalogInFrequencySet(hdwf, c_double(100000000.0))  and use the maximum buffer 8192 dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(8192)) that means that every buffer responds to 8192/100000000=81.92ns? So if I want to get values for 9ms i should write almost 100 time my buffer?  Furthermore I want to use trigger so I must go to single scan since in other modes trigger is ignored?

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