• 0
cfatt7

Synchronize 2 Outputs on Analog Discovery 2

Question

Hi,

 

I am trying to synchronize two sine waves referring to the sample file "analogout_sync.cpp" using the master and slave technique, but I feel like there is too much of a delay before the second wave is generated still. When I use an external oscilloscope, it shows that the sine waves are not in sync and the phases change for the waves every time the program is rerun, so I can't hardcode a phase to fix it. Is there any way to make sure I can sync the two waves using C++ code?

Thanks

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1

Hi @cfatt7

Yes, you can use the FDwfAnalogOutConfigure(..., -1, ...) to start channels synchronized.

You can also use the FDwfAnalogOutMasterSet to specify the master channel, then starting master channel will also start the slave channels. This is important in case you are using external triggering or cross-triggering with other instruments.

Specifying a finite run length is useful to keep different frequencies phase aligned, using the minimum frequency or greatest common divisor.
Like 1kHz might be generate as 0.9999999kHz and 2kHz as 2.000000001kHz, which could shift slowly over time. In this case use 1ms (1/1kHz) run time.

FDwfAnalogOutRunSet(..., ..., 1.0/min_freq); FDwfAnalogOutRepeatSet(..., ..., 0);

See the WF SDK/ samples/ py/ AnalogOut_Sync.py examples

Edited by attila

Share this post


Link to post
Share on other sites
  • 0

I got it. I decided not to use the master and slave technique, and just ran "FDwfAnalogOutConfigure" with the idxChannel  as -1 to run all the enabled channels at once.

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