Jump to content
  • 0

Export captured digital data to Waveform acquisition format in python


Nithin

Question

Hi,

I have a custom built Testing program in python that captures Analog Discovery (AD2) digital-In data for certain period and compares the captured data against some expected results.

Is there any way I could export the captured data to Waveform's ".dwf3logicacq" file format, so that I can view the captured data in Waveform application for debugging?

Here is a code snippet from my test program. I would like to save the data accumulated in 'rgwSamples'

-----

rgwSamples = (c_uint16 * nSamples)()
while (cSamples < nSamples):
    if (self.exitFlag != False):
        break
    dwf.FDwfDigitalInStatus(hdwf, c_int(1), byref(sts))
    dwf.FDwfDigitalInStatusRecord(hdwf, byref(cAvailable), byref(cLost), byref(cCorrupted))
    cSamples += cLost.value
    if cLost.value:
        fLost = 1
    if cCorrupted.value:
        fCorrupted = 1
    if cAvailable.value == 0:
        continue
    if cSamples + cAvailable.value > nSamples:
        cAvailable = c_int(nSamples - cSamples)
    dwf.FDwfDigitalInStatusData(hdwf, byref(rgwSamples, 2 * cSamples), c_int(2 * cAvailable.value))
    cSamples += cAvailable.value

dwf.FDwfDigitalInConfigure(hdwf, c_bool(0), c_bool(0))  # Halt the sampling.
dwf.FDwfDigitalInTriggerSourceSet(hdwf, trigsrcNone)
dwf.FDwfDigitalInTriggerPositionSet(hdwf, c_int(0))

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

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