Jump to content
  • 0

AnalogIN record problem


mika_elektrika

Question

Hi I am using analogIN record for acquisition of the signal. The problem I encountered is the fact that the acquired signal is randomly delayed in with repetition of the measurements. (see fig attached, where a same measurement is performed several time. Starting point always differ). Is there a particular reason for it and is there an elegant solution except the dirty one which compares delays of different measurements and performs the delay shift operation. 

Many thanks in advance. I used  AnalogIn_Record.py from the example library and analog discovery 2. 

thanks  & cheers,

m

 

delay.thumb.png.17f7e6b3605f0d1d04cdb6b12a28a7a1.png

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

23 hours ago, attila said:

Hi @mika_elektrika

The AnalogIn_Record.py example does not use any trigger, so the capture timing is undetermined.
This example uses trigger: AnalogIn_Record_Trigger.py

thanks @attila for the very prompt response. I tried to adjust the code to my libraries but I have a problem with statusData2 function. What is the difference between the statusData and statusData2 function?

 

this is the example how my statusData function is defined as part of analog input (ai)         self.rgwSamples = self.ai.statusData(self.sample_count)

thanks in advance! 

 

Link to comment
Share on other sites

Hi @mika_elektrika

The record mode with trigger position does not know when the trigger will occur, so it keeps feeding data and stops at the specified position after the trigger event.
After recording the data needs to be aligned, since the last captured sample is somewhere in the middle of the application record buffer.

The FDwfDigitalInStatusData2 lets you return a part of data from the desired index of the current chunk (nAvailable).
This is useful in record mode when the end of the record buffer is reached. The application has to fill the remaining space in the buffer and to continue from the head of the buffer. First it gets samples for the remaining space (nSpace), then for the head gets the remaining samples (= nAvailable - nSpace) starting with the index = nSpace.

Link to comment
Share on other sites

Hi @attila

thank for the explanation. Nonetheless I am still not able to find the FDwfAnalogInStatusData2 definition within the dwf.py or waveform libraries. For instance in dwf.py a simple FDwfAnalogInStatusData without 2 is defined as:

#  FDwfAnalogInStatusData(HDWF hdwf, int idxChannel, double *rgdVoltData, int cdData);
_xdefine("FDwfAnalogInStatusData",
         (HDWF, c_int, POINTER(c_double), c_int,),
         ((_ARGIN, "hdwf"), (_ARGIN, "idxChannel"),
          (_ARGIN, "rgdVoltData"), (_ARGIN, "cdData"),))
def FDwfAnalogInStatusData(hdwf, idxChannel,
                           rgdVoltData_or_cdData, cdData=None):
    if cdData is not None:
        return _FDwfAnalogInStatusData(hdwf, idxChannel,
                                       rgdVoltData_or_cdData, cdData)
    cdData = rgdVoltData_or_cdData
    rgdVoltData = (c_double * cdData)()
    _FDwfAnalogInStatusData(hdwf, idxChannel, rgdVoltData, cdData)
    return tuple(rgdVoltData)

 

but there is no definition of the equivalent with the stautsdata2. I tried to build it as attached in the file 1 (there are two dependencies waveform and dwf) but I am still getting a troubles with triggering. Any suggestions concerning it? And I would really appreciate your help concerning the definition of the analogstatusdata2 function.

many thanks!

AnalogIn_Record_trig_m.py

waveform.py

dwf.py

Link to comment
Share on other sites

Hi @mika_elektrika

I see you are using a 3rd party wrapper from which this function is missing.

The functions are defined in dwf.h

DWFAPI BOOL FDwfAnalogInStatusData(HDWF hdwf, int idxChannel, double *rgdVoltData, int cdData);
DWFAPI BOOL FDwfAnalogInStatusData2(HDWF hdwf, int idxChannel, double *rgdVoltData, int idxData, int cdData);
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- rgdVoltData – Pointer to allocated buffer to copy the acquisition data.
- idxData – First sample index to copy.
- cdData – Number of samples to copy.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...