Jump to content
  • 0

Synchronous acquisition of digital and analog signals through AD2


Alessandro

Question

Hello,
I'm writing into the forum because I need to acquire 2 analog input signals (multilevel signals) and 1 digital input signal in order to sample the analog ones. I'm retrieving the 2 analog signals using the 2 analog scopes of the Analog Discovery 2, while I saw that I can retrieve the digital one using a DIO port. This is simple using the Waveforms software, but I would like to use a Python script (code as attachment).

Basically I acquire the analog signals using:

dwf.FDwfAnalogInStatusData2(hdwf, c_int(0), byref(rgdSamples1, sizeof(c_double) * iSample), c_int(iBuffer), c_int(cSamples)) # get channel 1 data
dwf.FDwfAnalogInStatusData2(hdwf, c_int(1), byref(rgdSamples2, sizeof(c_double) * iSample), c_int(iBuffer), c_int(cSamples)) # get channel 2 data

These analog signals are synchronous.

The question is: How can I acquire the digital signal from the DIO port? Is it possible to have a digital signal that is synchronized (or shifted by an offset) with respect to the analog signals?
Thank you!

Alessandro

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @Alessandro

See the WF SDK/ samples/ py/ AnalogInDigitalIn_Acquisition.py

dwf.FDwfDigitalInTriggerSourceSet(hdwf, trigsrcAnalogIn) # trigger digital-in on analog-in
# recommended to configure the same rate, trigger position but it is not mandatory
dwf.FDwfDigitalInConfigure(hdwf, c_int(1), c_int(1)) # start digital-in
dwf.FDwfAnalogInConfigure(hdwf, c_int(1), c_int(1)) # start analog-in
# loop 
#   dwf.FDwfDigitalInStatus(hdwf, c_int(1), byref(sts))
#   dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts))
#   dwf.FDwfDigitalInStatusData(hdwf, ...
#   dwf.FDwfAnalogInStatusData(hdwf, ...

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...