Jump to content
  • 0

Why is FDwfAnalogInStatus always used in loops?


Marcus Watson

Question

Hi all,

Apologies for the basic level of this question, but I'm genuinely confused about something from the script examples provided with the Waveforms SDK. Why do all analogin examples use while loops, in which data is repeatedly sampled with FDwfAnalogInStatus? 

What I would really like to be able to do is the following: set the acquisition mode to record (and set other parameters accordingly), then start acquisition using FDwfAnalogInConfigure, then NOT enter any kind of Digilent-related while loop, and then at the end of a set time (close to the RecordLength parameter), collect the data in the buffer with FDwfAnalogInStatus. 

The reason for this is that I'm trying to control my Discovery 3 from within code that controls a neuroscience experiment, which has its own complex set of loops and conditionals. Critically, these loops are dependent on the frame rate of the monitor we are using to present stimuli. There isn't any clean way I can see of incorporating the kinds of loops that are in every example in the SDK inside these other control loops, which is why I was hoping to just use a simple "start acquisition" "do other stuff" "stop acquisition" model.

Thoughts?

Marcus

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @Marcus Watson

If you are capturing up to device buffer size of samples you can use acqmodeSingle, see WF SDK/ samples/ py/ AnalogIn_Acquisition.py, AnalogIn_Trigger.py.... This does not need loop, but you should verify if the capture is done with FDwfAnalogInStatus before reading the data.
The record mode is for capturing more samples at lower rate, using data streaming and this requires loop to transfer the chunks of data.

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