Jump to content
  • 0

ad2 quadrature FM example/contribution


darth458

Question

This code requires you to connect the outputs to their respective inputs with same length cables and you need a jumper between trig1 and D0 which is easy to do on the header.

It produces two quadrature phase channels which are both FM modulated with high index. I was impressed by the performance of the AD2 in the sense that FM is accomplished

in a robust way by mathematical phase manipulation so that the output that is received by the ADC conforms well to the desired waveform. There's only one problem which is that

the code doesn't always work. Sometimes channel two is just a straight line a 1 Volt, I invoke the code over and over and the internal state changes and the AD2 acts differently. At

least mine does. I don't need help with this because I have moved on to another method but it might be worth a look at Digilent headquarters to see what's up.

 

About the code: this is hackware, ugly stuff with no error checking, use at your own risk, etc. With a device like this a lot of the time you want is just an example of how to do

something. The code is properly constructed only in the sense that it drives the API to do a particular thing. If no one objects I will offer up a few more examples. I like the

platform a lot and would like it to thrive and evolve which is why I'm taking a stab at contributing.

setup.cpp

swoop_1.cpp

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Hi @darth458

The 3rd configuration does not have digital-in-out functions, but to generate bursts on analog-out you don't even need this.
You can use the wait and run parameters for this.
FDwfAnalogOutRunSet(hdwf, 0, 0.001); // run for 100us
FDwfAnalogOutWaitSet(hdwf, 0, 0.1); // wait 100 millisecond

If you need digital trigger output to signal analog-out start you can use:
FDwfDeviceTriggerSet(hdwf, 0, trigsrcAnalogOut1);

To run the analog-out channels in synchronized mode, at the same time with the same trigger-wait-run-repeat options use:
FDwfAnalogOutMasterSet(hdwf, 1, 0); // analog-out-1 will be controller by analog-out-0
FDwfAnalogOutConfigure(hdwf, 0, true)

Or just call configure with -1 which will make the first enabled channel master:
FDwfAnalogOutConfigure(hdwf, -1, true)

To set the analog-in buffer size to 8000 for normal acquisitions (funcSingle) use the FDwfAnalogInBufferSizeSet:
FDwfAnalogInBufferSizeSet(hdwf, mybuflen);

The 8000 samples at 100MHz captures 80us, so to have the start of the capture on analog-out start set position to half of this:
FDwfAnalogInTriggerPositionSet(hdwf, 0.00004);

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...