Hi, I'm new to using DAQmx so this probably has an obvious solution I am overlooking--
I am writing a program using Measurment Studio and DAQmx in C# to control an electrophysiology setup, and one of the tasks I need to do is to send a constant DC voltage on an analog out line. I know I could do this by generating a constant waveform and running the task forever, but it seems that there should be an alternative method. I have a 6052E DAQ board, so I looked at the E series documentation and it says that this sort of task is typically done using on demand timing by sending a single sample to the board. This is the code I am using to try to do this:
/// <summary>
/// <c>SetHoldingPotential(double vhold)</c> sets the cell holding potential to <c>vhold</c> mV.
/// </summary>
/// <param name="vhold">The new holding potential, in mV.</param>
public void SetHoldingPotential(double vhold)
{
try
{
_CurrentTask = new Task("Set Holding Potential");
_CurrentTask.AOChannels.CreateVoltageChannel(VHoldAO,"VHold",VHoldMin, VHoldMax, AOVoltageUnits.Volts);
// No timing set up, just sending one sample with software timing
_CurrentTask.Control(TaskAction.Verify);
AnalogSingleChannelWriter writer = new AnalogSingleChannelWriter(_CurrentTask.Stream);
double output = vhold*this.VoltageOutScalingFactor;
writer.WriteSingleSample(true,output);
_CurrentTask.Dispose();
}
catch(DaqException e)
{
System.Windows.Forms.MessageBox.Show("Amplifier: " + e.Message);
}
}When I call this method, I see the amplifier I have hooked up to the AO go up in voltage, but then it very quickly resets to the original voltage. I noticed that one of the properties of AOChannels is IdleOutputBehavior, but if I try to set that then I get a DAQmx error telling me the property is not supported. Any ideas on what I am doing wrong?
Thanks,
Stephen Helms