Jump to content
  • 0

Correct Way to Change/Update AnalogOut Waveform for Waveforms SDK?


timmolter

Question

Hi,

I just want to make sure I'm doing this right... 

For the app I'm developing, I have a few sliders and other widgets that define the parameters of a waveform. When something is changed I call:

FDwfAnalogOutNodeEnableSet(idxChannel, true);
FDwfAnalogOutNodeFunctionSet(idxChannel, waveform.getId());
FDwfAnalogOutNodeFrequencySet(idxChannel, frequency);
FDwfAnalogOutNodeAmplitudeSet(idxChannel, amplitude);
FDwfAnalogOutNodeOffsetSet(idxChannel, offset);
FDwfAnalogOutNodeSymmetrySet(idxChannel, dutyCycle);
return FDwfAnalogOutConfigure(idxChannel, true);

Is it OK to do it this way or should I first stop the waveform with `FDwfAnalogOutConfigure(idxChannel, false);`? So far it seems to be working fine the way I have it, but I want to double check. Thanks!

 

MD_Windows.png

Edit: Same question for analog in. Can I just keep calling the following code block to update the analog in "on the fly"?

FDwfAnalogInChannelEnableSet(DWF.OSCILLOSCOPE_CHANNEL_1, true);
FDwfAnalogInChannelRangeSet(DWF.OSCILLOSCOPE_CHANNEL_1, 2.5);
FDwfAnalogInChannelEnableSet(DWF.OSCILLOSCOPE_CHANNEL_2, true);
FDwfAnalogInChannelRangeSet(DWF.OSCILLOSCOPE_CHANNEL_2, 2.5);
FDwfAnalogInFrequencySet(frequency);
FDwfAnalogInBufferSizeSet(buffersize);
FDwfAnalogInAcquisitionModeSet(acquisitionMode.getId());
return FDwfAnalogInConfigure(false, true);

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hello,

Your function calls look good, but I would have the following observations:

1. For simplicity the error check is omitted in the example codes but you could add such like:
bool ConfigureAnalogIn(){
   if(!FDwfAnalogOutNodeEnableSet(idxChannel, true)) return false;
   if(!FDwfAnalogOutNodeFunctionSet(idxChannel, waveform.getId())) return false;
   ...
}
if(!ConfigureAnalogIn()){
   FDwfGetLastErrorMsg(...)
}

2. By default the auto-configuration is enabled. With this, each *Set function call configures the device which takes a few milliseconds. In case your are setting many parameters it might be better to disable it after opening the device with FDwfDeviceAutoConfigureSet(hdwf, false). Without auto-configure the set options are only applied when calling the respective *Configure function, like: FDwfAnalogOutConfigure( idxChannel, ...), FDwfAnalogInConfigure(...).

 
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...