Jump to content

Mohamad Idris

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Mohamad Idris's Achievements

Newbie

Newbie (1/4)

1

Reputation

  1. Hi @attila thanks for replying i have achieved it now anyways much thanks
  2. Thanks for the reply @attila can you please guide how can we generate these waves using the "patterns" while keeping in view the issues I am facing? I have attached a snapshot of the generated waveforms of different frequencies for your reference.
  3. I did that but the four signals have different frequencies and I am using the formula number of samples*frequency to set the sampling rate but post generation the frequency of the signals is not coming to be what is desired I have attached the files showing the type of waveforms to be generated
  4. I had posted this query earlier as well but to no use. I am trying to generate 4 signals at digital pins of ADP3450 using waveforms. Each signal has a frequency of 1khz/100hz with each signal having 1000 samples each. The fourth signal is much more straightforward and is on for the initial half-cycle and then off. In the first attempt, the "patterns" is used in BUS Mode with D0-D3 configured for generating these waveforms with a "Parameter1" frequency set using the formula frequency*numberof samples. However, this does not work as the frequency of one or two signals is incorrect on generation. To correct this I used a script but facing issues there as well. And I have pasted the code here // Check if the script is running in the WaveForms environment if (typeof Patterns === 'undefined') { throw "Please run this script in the WaveForms environment!"; } // Define digital patterns var amplitudes1 = [0, 5, 0, 5, 0, 5, 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 0, 5, 0, 5, 0, 5, 0, 5, 5, 0, 5, 0, 5, 0, 5, 0]; var amplitudes2 = [0, 0, 5, 5, 0, 0, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0, 0, 0, 5, 5, 0, 0, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0]; var amplitudes3 = [0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0]; var durations_us = [300, 200, 200, 250, 250, 300, 450, 550, 550, 450, 300, 250, 250, 200, 200, 300, 300, 200, 200, 250, 250, 300, 450, 550, 550, 450, 300, 250, 250, 200, 200, 300]; // Initialize Pattern Generator var Patterns = new Wavegen.WaveformManager(); Patterns.setup(); // Set up digital channels Patterns.channels = [ { enabled: true, mode: 'digital', values: amplitudes1 }, { enabled: true, mode: 'digital', values: amplitudes2 }, { enabled: true, mode: 'digital', values: amplitudes3 } ]; // Configure digital channels Patterns.channels.forEach((channel, index) => { if (channel.enabled) { Patterns.setupChannel(index, channel.mode); channel.values.forEach((value, i) => { Patterns.add(index, value, durations_us[i] / 1e6); // Convert microseconds to seconds }); Patterns.setSampleRate(1e6); // Set sample rate to 1 MHz Patterns.configure(index); } }); // Start the Pattern Generator Patterns.start(); // Wait for a certain amount of time (adjust as needed) wait(10); // Run for 10 seconds // Stop the Pattern Generator Patterns.stop(); I am getting a parse error Any help would be highly appreciated
  5. I am trying to develop a variable frequency square wave using waveforms and Analog Discovery 2. I want to specify the time attributes for which a pulse remains ON or OFF. The frequency option of the custom cannot be used since each pulse in the waveform is almost of different duration. Tried the wavegen, logic and pattern in the waveforms, but no luck so far. Any help would be appreciated.
×
×
  • Create New...