Post Go back to editing

ADALM2000 analog in and out in continuous loop

Category: Software

Hi,

I'm using analog output of M2K in non cyclic mode (c++/libm2k). I want to send burst of data and then analyze received data and finally plot graph using matplotlib. My sample rate is output sample rate is 5MSPS and input 1MSPS. How I can make this kind on continuous loop, which is sending burst let say 20 times in second and then receive the response in analog input? I have modified analog_in_out.cpp example, but I can only do one cycle.

  • Hello,

    I am not sure if I understood exactly what you are trying to do, but for continuous streaming you could modify the analog_in_out.cpp example like this:

    aout->setCyclic(false);
    for (int i = 0; i < NO_REPETITIONS; i++) {
    aout->push({sinv, saw});

    auto data = ain->getSamples(1024);

    cout << "CHANNEL1" << endl;
    for (double val: data[0]) {
    cout << val << endl;
    }
    cout << "CHANNEL2" << endl;
    for (double val: data[1]) {
    cout << val << endl;
    }
    }

    If this is not what you wanted to do, can you please provide your modified example?

  • Hello,

    Thank you. This solved my problem. I had "aout->stop();" in my loop, which probably caused my problem.