• 0
reddish

Analog Discovery: keep settings on open?

Question

Hi,

I have a question about the Analog Discover 2. I am programming it using Python.

When you close a device, it's possible to keep the device running by setting the "OnClose" parameter on the device. This is useful, e.g., when the AD2 is part of a larger measurement setup. I use it in this way to set a DC voltage on the AnalogOut device.

However,. when you later re-open the device, it resets the AnalogOut device, setting the output level to 0V.

 

Is there a way to prevent this resetting behavior at open time (analogous to preventing resetting of the device at close time)?

 

Best regards (and thanks for your wonderful product),

  Sidney

 

 

 

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Hi Attila,

That's great! Will this feature be available in upcoming stable releases as well?

For my application I need a 64-bit Linux version.

Best regards, Sidney

Share this post


Link to post
Share on other sites
  • 0

Hi @reddish

In the latest beta release the outputs won't be reset after re-opening the device:
https://forum.digilentinc.com/topic/8908-waveforms-beta-download/
Yes, this will remain for the stable release, but you can use the beta version safely as well.

Use the following sequence to change the output OnClose/Open/AutoConfigure/parameters/Configure/Close
Make sure to set all the option (amplitude, offset...) since after close these are lost. After re-open the parameters are initialized with default values, but the device analog-out channel will be configured only after calling FDwfAnalogOutConfigure.

dwf.FDwfParamSet(DwfParamOnClose, c_int(0)) # 0 = run, 1 = stop, 2 = shutdown
...
dwf.FDwfDeviceOpen(...
...
dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0))  # 0 = the instruments will be configured only when calling FDwf###Configure
...
dwf.FDwfAnalogOutNodeEnableSet(hdwf, channel, ... 
... 
dwf.FDwfAnalogOutConfigure(hdwf, channel, c_bool(True))
dwf.FDwfDeviceClose(hdwf)

 

Here you can see the analog-out (AWG) reconfigured with consecutive open/close.

image.png.7c51f16d9e823029a80075f2c7d08be2.png

Share this post


Link to post
Share on other sites
  • 0

I tested the solution with the new beta, this works -- thanks a lot, it saves us a lot of hassle.

It is necessary to set the "OnClose" parameter before doing the open. Am I correct in understanding that the "OnClose" parameter is now also inspected while opening a device? If so, this makes the name of the parameter a bit of a misnomer, of course..

Is there a way to  get the currently programmed and active value of the DC offset through the API, after opening a device without a reset/reconfigure?

 

As a last remark: I made a pretty eleborate Python binding to libdwf, which I plan to put on github once I'm satisfied with it. In the process of making this, I encountered a few minor issues in the header file dwf.h. Is this forum the correct place to report those issues, or should I send them to some email address?

 

Best regards, Sidney
 

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

Hi @reddish

Yes, before opening. The FDwfParamSet are global options passed to the device on open. 
These are newly added options based on user requests.

The OnClose refers to closed device behavior and also affects the initial reset on open.

There is not way to retrieve the currently configured value after re-open. On close the library software resources are freed up and there is no read option in the analog-out HDL logic of the device FPGA.
I think your high level application/script could easily remember these parameters.

You could send it as you prefer, as post, private message or email like waveforms at digilentinc dot com
Thank you for your git contribution in advance.

Edited by attila

Share this post


Link to post
Share on other sites
  • 0

Thanks for the answer, indeed it is no big deal to save this state myself. I was mostly just curious if there was a solution.

I will write an email with my comments about dwf.h.

Thanks a lot for your assistance.

Share this post


Link to post
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