Hello Chris,
I am not clear on the use of NIDAQ analog output waveform; do you have an example for a sinusoidal generation?
Cheers,
Beshoy
Hello Chris,
I am not clear on the use of NIDAQ analog output waveform; do you have an example for a sinusoidal generation?
Cheers,
Beshoy
would something like this work? iochannel tag=“A_out” type=“nidaq_analog_output_voltage_waveform” voltage=“v_out” range_max=“5” range_min=“0” channel_number=“0” waveform=“sinusoid” period=“500ms” offset=“0”/
Cheers,
Beshoy
Hi Chris,
I tried it and it works but i have a couple of issues:
-can i turn the wave from on and off without turning the NIDAQ on and off?
-the default value of the output is always midway between min and max voltages when the output isn’t on; is this normal?
-can i change the frequency on the fly or do i have to load and unload the experiment? For now, changing the period variable during the experiment doesn’t have an effect.
Cheers,
Beshoy
Hi Beshoy,
can i turn the wave from on and off without turning the NIDAQ on and off?
No, that isn’t supported at present.
the default value of the output is always midway between min and max voltages when the output isn’t on; is this normal?
You mean before the NIDAQ device has been started (or after it’s been stopped)? I don’t think there’s any way to control (via software) the state of the outputs when the device isn’t running. Whatever happens is probably hardware dependent.
can i change the frequency on the fly or do i have to load and unload the experiment?
You have to reload the experiment. I don’t think it’s possible (in terms of hardware and/or driver support) to alter the waveform while the device is running. We could change MWorks’ interface so that you can alter parameters while the device is stopped, but that isn’t supported currently.
Cheers,
Chris
Hi Chris,
Thanks for the reply. If it’s possible to enable turning the channel on and off and/or change the frequency when the device is off, that would be great and eliminate the need for using external function generators. I don’t need the frequency to be changed while it’s running, just between protocols for example.
What I did so far is having different device configurations with one having analog waveform and the other having the regular constant output. Then, I turn on the device with the waveform configuration when I need it.
Cheers,
Beshoy
Hi Beshoy,
If it’s possible to enable turning the channel on and off and/or change the frequency when the device is off, that would be great and eliminate the need for using external function generators.
OK, I’ll add those to my to-do list.
What I did so far is having different device configurations with one having analog waveform and the other having the regular constant output. Then, I turn on the device with the waveform configuration when I need it.
So your experiment has two different NIDAQ devices in it, both of which use the same piece of hardware? If so, I’m very surprised that works.
Chris
Hello Chris,
I was suspicious at first as well, but it worked. One of the problems with this solution is that timing is a pain to adjust as turning the device on and off takes time. Also, when turning the device off, there is a bit of time where the signal is continuous and not oscillating.
However, one of the things i appreciate about using the NIDAQ with Mworks is that the phase of the produced sinusoidal is very consistent; so every time the device is turned on, the produced signal is at the same phase.
Any ETA on those features? I am just trying to see if I can wait for your updates instead of purchasing a new function generator.
Cheers,
Beshoy
Hi Beshoy,
Any ETA on those features? I am just trying to see if I can wait for your updates instead of purchasing a new function generator.
It shouldn’t be a big job, but I’m a bit swamped at the moment. Realistically, I can probably get the changes in to the nightly build within 1-2 months. If you don’t want to use the nightly build, you’ll have to wait for the next official MWorks release (tentatively coming in spring of 2019).
Chris
Hi Chris,
That’s alright, that sounds reasonable. I can then test it out with the nightly build.
Cheers,
Beshoy
Hi Beshoy,
As of the current MWorks nightly build:
NIDAQ analog output can be stopped and restarted (independently of other input/output tasks) via the new analog_output_enabled parameter.
Note that the NI drivers available for macOS don’t allow individual analog output channels to be stopped and started independently. Therefore, analog_output_enabled
will start or stop all analog outputs.
The waveform parameters of a NIDAQ analog output waveform channel can be modified while the experiment is running. Changes take effect after analog output is stopped and restarted (either by stopping and starting the entire device, or by stopping and starting just analog output using analog_output_enabled
).
To make this work sensibly, I added two new parameters (amplitude and mean) to waveform channels. If you omit these, they will be derived from range_min/range_max as before. However, range_min/range_max cannot be changed after the experiment is loaded, so if you want to change amplitude and/or mean at run time, you’ll need to use the new parameters.
I’ve attached a small example experiment that demonstrates how to change a waveform on the fly.
Unfortunately, I still haven’t found a reliable way to zero out waveform channels when the device is stopped. The NI API doesn’t appear to provide any support for this. I tried a “brute force” approach, wherein I stopped analog output, set all output samples to zero, restarted output, and restopped. This works, but it was causing issues in some of my tests, so I’m not sure it’s really a good idea. Of course, you can do the same thing in your experiments (by stopping, setting amplitude and mean to zero, restarting, and restopping), which might be a viable solution in some cases.
Cheers,
Chris
Attachment: waveform_change.mwel.zip (484 Bytes)
Hi Chris,
Sorry didn’t reply earlier. I managed to give the script a quick test around the Christmas break here and it works; thanks a lot. I tried to play around with how to reset it; I think one way is to set the mean/amplitude to zero does it (after disabling the channel and enabling with the new values). However, I haven’t tested it extensively yet. Having all the analogue outputs turn on at the same time isn’t an issue right now as we would only use one.
Cheers,
Beshoy