Jump to content
  • 0

ThisJohn

Question

I know that Analog Discovery 2 (and also the Pro) has two analog output channels but I was wondering if there is a way to generate 4 arbitrary sine waves, in particular I was thinking if any of the below is feasible:

1. Generate 4 arbitrary sine waves using the PWM and digital outputs.
2. Generate two sine waves using the two output arbitrary wave generator and:
   2.a: Replicate them somehow (so other two generated sine waves will be similar to the first two generated ones)
   2.b: Replicate and phase shift them somehow (so other two generated sine waves will be similar to the first two generated ones with a phase shift)


Thsnks, and sorry if something is wrong with my first post!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @ThisJohn

You could generate PWM (or PDM would give better result) with the Wavegen editor (or Excel) and copy&paste data in the Pattern Custom signal or use Script to populate. Use the Delay option or phase the samples.
The Pattern works at fixed sample rate so for arbitrary (and high) frequencies the number of samples should be changed. Like here 100MHz/1000 samples would give 100kHz, 10us. You could use 4th device configuration for more Pattern custom buffer (16Ki) for higher PWM resolution. 

image.png

image.png

image.png

image.png

image.png

const n = 1000;
var rg = [];
for(var i = 0; i < n; i++){
    rg.push((10.0*(sin(2.0*PI*i/n)+1) > i%20)?1:0);
}
Patterns.Channels.DIO0.custom = rg;
Patterns.Channels.DIO1.custom = rg;
Patterns.Channels.DIO2.custom = rg;

 

Link to comment
Share on other sites

  • 0

Hi @attila,

Thank you so much for your explanation. Very interesting ! I will try it out as soon as I get the device and will let you know about it.
Just to make sure I got the "Excel" part right, so you mean if I had like a CSV file that contains the sampling data of my custom waveform (I mean samples of the custom sine-wave itself) would I be able to provide it to the waveform software and it get generated? if yes does the CSV needs to have a particular format?
P.S. I do have such CSV.

Thanks

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