Jump to content
  • 0

Analog Discovery 2


mnorth

Question

I just received my AD2 and am running the python examples from the SDK directory.
Looking at the forum this feels like a very silly question.  I've got a scope hooked up to DIO 0 and I can't see
any analog signals like from example: AnalogOut_sine.py or AnalogIn_Record.py.  
I've notice the numpy plts, maybe that's the hint that I can't use the scope to view analog output?

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Thanks Atilla.  a few more elementary sounding questions.  I wanted to see if I could input something analog trying to use say, AnalogIn_Sample.py...
I just connected V+ supply to DIO0 and then 1+...my DMM read ~58mV-ish...the results that printed out weren't good.
I looked around for setting the supply power and found: AnalogIO_AnalogDiscovery2_Power.py 
FDwfAnalogIOChannelNodeSet(hdwf,idxChannel, idxNode, value)
# enable positive supply
dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(0), c_int(0), c_double(True)) 
# set voltage to 5 V
dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(0), c_int(1), c_double(5.0)) 

1) I don't measure anything out of V+ and nothing from channel 0.
2) I've been reading the API.  What exactly is a "Node Index" ?  Is that to distinquish between an enable and a set value?
3) So, back to AnalogIn_Sample.py...I don't have a function generator...use an old 10k pot as an input to 1+ ??

Link to comment
Share on other sites

  • 0

Hi @mnorth

Did you set the master enable? as it is AnalogIO_AnalogDiscovery2_Power.py
By default on app/script exit or device close function the outputs are stopped (disabled). Keep the app/running or set the onclose to run.

# master enable
dwf.FDwfAnalogIOEnableSet(hdwf, c_int(True))

# 0 = run, 1 = stop, 2 = shutdown
dwf.FDwfParamSet(DwfParamOnClose, c_int(0))

Link to comment
Share on other sites

  • 0

Thanks Atilla. 
I am fiddling with a trigger idea using python and have been using example: AnalogIn_Record.py.
I'm sending an analog input signal to Scope 1+ and am successfully writing it to the csv file.  
I followed DigitalOut_custom example and in the same trigger code produced a signal with a period of 2usec with the first 500nsec high, on DIO1.  
I am hoping to write a trigger for the falling edge of this DigitalOut signal and to only capture say n samples per falling edge.
Can we trigger on a digitalOut signal and acquire data from the analogIn?
If so, is there an example (I have looked...I could have missed it)?  If not, that's interesting...do you have a suggestion?

 

Link to comment
Share on other sites

  • 0

Hi @mnorth

The AnalogIn could be triggered on the DigitalOut start or each period/restart if you are using finite run:
dwf.FDwfDigitalOutRunSet(hdwf, c_double(cSamples/hzRate))
dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDigitalOut) 

Trigger on DIO1 could be done using the DigitalIn trigger detector but it is easier to hook the DIO1 to T1 and trigger AnalogIn on this.
dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcExternal1) 
dwf.FDwfAnalogInTriggerConditionSet(hdwf, DwfTriggerSlopeFall) 

Link to comment
Share on other sites

  • 0

Thanks Atilla. I'm sending an analog input to Scope 1+.  I followed DigitalOut_custom example and in the same trigger code produced a
2usec digitalOut signal with the first 500nsec high, on DIO1.  Wanting to write a trigger for the falling edge of this DigitalOut signal and
only capture say n samples per falling edge of 100-ish cycles.
I'm not sure about the AcqFrqHz ideas...could you give me some ideas about how to choose those numbers?
Obviouly, change anything...

100 cycles: c_psecRun = 0.2 sec

pattern_repeat = 100                    # fixed number
nSamples = ???

AcqFrqHz = c_double(???

# SETUP AnalogIn ACQUISITION
dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True))
dwf.FDwfAnalogInAcquisitionModeSet(hdwf, acqmodeRecord) 
dwf.FDwfAnalogInFrequencySet(hdwf, AcqFrqHz

### RecordLength is in sec.  Would record time be the same as c_psecRun ?                                                                                          
dwf.FDwfAnalogInRecordLengthSet(hdwf, c_double(nSamples/AcqFrqHz.value))

# SETUP TRIGGER on DOut_1:
dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorDigitalIn)                            
dwf.FDwfDigitalInTriggerSet(hdwf, c_int(0), c_int(0), c_int(0), c_int(1<<1))    
 
### Is (???), nSamples/pattern_repeat ?                  
dwf.FDwfDigitalInTriggerPositionSet(hdwf, c_int(int( ??? )))                                              
dwf.FDwfDigitalInTriggerCountSet(hdwf, c_int(1), c_int(0))                     

time.sleep(1)

dwf.FDwfAnalogInConfigure(hdwf, c_int(1), c_int(1))
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))  

Link to comment
Share on other sites

  • 0

Hi @mnorth

The record mode is intended for long captures, streaming samples and the frequency can be up to about 1-2MHz.
If you want to capture only up to 8/16Ki samples you can use the normal (single) capture mode at up to 100MHz.

Edited by attila
Link to comment
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
×
×
  • Create New...