Kostas Posted March 26, 2019 Share Posted March 26, 2019 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? Link to comment Share on other sites More sharing options...
attila Posted March 26, 2019 Share Posted March 26, 2019 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 Link to comment Share on other sites More sharing options...
Kostas Posted March 27, 2019 Author Share Posted March 27, 2019 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 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? Link to comment Share on other sites More sharing options...
attila Posted March 27, 2019 Share Posted March 27, 2019 Hi @Kostas I was referring with normal to single acquisition mode. Link to comment Share on other sites More sharing options...
Kostas Posted March 27, 2019 Author Share Posted March 27, 2019 3 hours ago, attila said: Hi @Kostas I was referring with normal to single acquisition mode. 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. Link to comment Share on other sites More sharing options...
attila Posted March 27, 2019 Share Posted March 27, 2019 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: 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. Link to comment Share on other sites More sharing options...
Kostas Posted March 28, 2019 Author Share Posted March 28, 2019 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: 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. 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? Link to comment Share on other sites More sharing options...
Question
Kostas
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?
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.