Jump to content
  • 0

Manual Frequency control loop via SDK


StefKay

Question

Hello,

I am using the AD3 via SDK to generate a ~200 Hz sine wave. Depending on some measurement & claculation, I do adjust the frequency via FDwfAnalogOutNodeFrequencySet. Frequency Increments/Decrements can be as low as some mHz. Now I see, that always when setting the frequency, the waveform stops for ~2ms before it restarts with the newly set frequency.

Now I have two questions:

  1. Is there a way to change the frequency 'randomly' from the SDK, without stoping the waveform for every new frequency?
  2. Can this somehow be done on both output channels synchronously, by keeping a constant phase-shift between CH1 & CH2?
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @StefKay

1. Yes

dwf.FDwfDeviceOpen(-1, byref(hdwf))
# the device will only be configured when FDwf###Configure is called
dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) 
...
dwf.FDwfAnalogOutFrequencySet(hdwf, 0, c_double(hzNow))
dwf.FDwfAnalogOutConfigure(hdwf, 0, 3)


2. Unfortunately no. The channels need to be restarted to be in phase.

Link to comment
Share on other sites

  • 0

Hello @attila

Thanks for your response, but unfortunately this seems not to work properly for us. When we are doing the dwf.FDwfAnalogOutConfigure(Apply) after every dwf.FDwfAnalogOutFrequencySet(Freq), the frequency output is always somehow delayed/distorted, right before the new frequency is applied.

See attached screenshot.

What we would need, is to beeing able to change the frequency in the mHz range, without distorting the output.

Otherwise our DUT gets out of resonance and needs a very long time, to re-stabilize.

Is there some way to do this with the SDK?

 

On 6/24/2024 at 9:23 PM, attila said:

Hi @StefKay

1. Yes

dwf.FDwfDeviceOpen(-1, byref(hdwf))
# the device will only be configured when FDwf###Configure is called
dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) 
...
dwf.FDwfAnalogOutFrequencySet(hdwf, 0, c_double(hzNow))
dwf.FDwfAnalogOutConfigure(hdwf, 0, 3)

 

 

 

SCR01.PNG

Link to comment
Share on other sites

  • 0

Hi @StefKay

Use custom sine instead of funcSine, like:
    cSamples = 32*1024
    rgdSamples = (c_double*cSamples)()
    channel = c_int(0)
    # samples between -1 and +1
    for i in range(cSamples):
        rgdSamples[i] = numpy.sin(2.0*numpy.pi*i/cSamples);
    dwf.FDwfAnalogOutFunctionSet(hdwf, 0, funcCustom)
    dwf.FDwfAnalogOutDataSet(hdwf, 0, rgdSamples, c_int(cSamples))

For newer (AD3,ADP2230,ADP3X50) devices to have more precise arbitrary frequency for the standard functions the waveform length is adapted. This has this glitch side effect on frequency adjustment, but custom waveforms should be stable. I'll try to improve this somehow in the future...

 

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