I am currently developing a custom GUI with Qt, which includes an oscilloscope. I'm utilizing the ADP 3450. My task involves plotting waves with a frequency of 1 million Hz and an amplitude of 1 Vpp. Additionally, it operates in burst mode with a trigger interval of 1 second. Currently, I'm employing FDwfAnalogInAcquisitionMode as scanmodeshift.
I'm encountering below issues:
The time range is very limited (currently at 0.2 seconds), which prevents me from observing more than one wave bunch. Ideally, I would like to visualize multiple pulses over a couple of seconds.
Another issue lies in the plot amplitude, which doesn't reach 0.5 V and -0.5 V. but, increasing the frequency allows it to touch the peaks.
Could you advise on how to address these issues and suggest the correct method for plotting in such cases?
I am adding one screenshot also with this.
I am using the SDK (C++) provided by Waveform, and the Qt version is 5.15.3. I am generating and plotting with the same device (ADP 3450). I also attempted generating from another source. I am providing the header file and source file of the basic Qt code (I am using QCustomPlot for plotting).
#include"mainwindow.h"#include"ui_mainwindow.h"#include<fstream>MainWindow::MainWindow(QWidget*parent):QMainWindow(parent), ui(newUi::MainWindow){
ui->setupUi(this);
setGeometry(400,250,542,390);
setupRealtimeDataDemo(ui->customPlot);
connect(&dataTimer, SIGNAL(timeout()),this, SLOT(realtimeDataSlot()));
dataTimer.start(100);// Adjust the interval based on your preference}voidMainWindow::setupRealtimeDataDemo(QCustomPlot*customPlot){
rgdSamples.resize(nSamples);if(!FDwfDeviceOpen(-1,&hdwf)){FDwfGetLastErrorMsg(szError);return;}FDwfDeviceAutoConfigureSet(hdwf,0);// Setup sine wave generation parameters
sinAmplitude =1.0;
sinFrequency =1000000.0;
wf_run_time =0.2;
wf_wait =0.8;// Configure Digilent Analog Out for sine wave generationFDwfAnalogOutNodeEnableSet(hdwf,0,0,1);FDwfAnalogOutNodeFunctionSet(hdwf,0,0,1);// Sine functionFDwfAnalogOutNodeFrequencySet(hdwf,0,0, sinFrequency);FDwfAnalogOutNodeAmplitudeSet(hdwf,0,0, sinAmplitude);FDwfAnalogOutRunSet(hdwf,0, wf_run_time);FDwfAnalogOutWaitSet(hdwf,0, wf_wait);FDwfAnalogOutRepeatSet(hdwf,0,0);FDwfAnalogOutConfigure(hdwf,0,1);// Configure Digilent Analog In for data acquisitionFDwfAnalogInChannelEnableSet(hdwf,0,1);FDwfAnalogInChannelRangeSet(hdwf,0,5);FDwfAnalogInAcquisitionModeSet(hdwf,1);// acqmodeScanShiftFDwfAnalogInFrequencySet(hdwf, hzAcq);FDwfAnalogInBufferSizeSet(hdwf, nSamples);FDwfAnalogInConfigure(hdwf,1,0);Wait(2);FDwfAnalogInConfigure(hdwf,0,1);// Setup the QCustomPlot for visualization
customPlot->addGraph();
customPlot->graph(0)->setPen(QPen(QColor(40,110,255)));
customPlot->axisRect()->setupFullAxesBox();
customPlot->xAxis->setRange(0, nSamples);
customPlot->yAxis->setRange(-2.5,2.5);
connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));
connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange)));}voidMainWindow::realtimeDataSlot(){// Fetch data from the Digilent WaveForms deviceFDwfAnalogInStatus(hdwf,1,&sts);FDwfAnalogInStatusSamplesValid(hdwf,&cValid);FDwfAnalogInStatusData(hdwf,0, rgdSamples.data(), cValid);// Get channel 1 data// Convert QVector<double> to QCPGraphDataContainerQCPGraphDataContainer dataContainer;for(int i =0; i < rgdSamples.size();++i){
dataContainer.add(QCPGraphData(i, rgdSamples[i]));}// Update the plotQSharedPointer<QCPGraphDataContainer> dataContainerSharedPointer =QSharedPointer<QCPGraphDataContainer>::create(dataContainer);
ui->customPlot->graph(0)->setData(dataContainerSharedPointer);
ui->customPlot->replot();}MainWindow::~MainWindow(){delete ui;}
I hope this helps! Let me know if you need further details.
Question
Fausto
Posted for @fahiz.
I am currently developing a custom GUI with Qt, which includes an oscilloscope. I'm utilizing the ADP 3450. My task involves plotting waves with a frequency of 1 million Hz and an amplitude of 1 Vpp. Additionally, it operates in burst mode with a trigger interval of 1 second. Currently, I'm employing FDwfAnalogInAcquisitionMode as scanmodeshift.
I'm encountering below issues:
The time range is very limited (currently at 0.2 seconds), which prevents me from observing more than one wave bunch. Ideally, I would like to visualize multiple pulses over a couple of seconds.
Another issue lies in the plot amplitude, which doesn't reach 0.5 V and -0.5 V. but, increasing the frequency allows it to touch the peaks.
Could you advise on how to address these issues and suggest the correct method for plotting in such cases?
I am adding one screenshot also with this.
I am using the SDK (C++) provided by Waveform, and the Qt version is 5.15.3. I am generating and plotting with the same device (ADP 3450). I also attempted generating from another source. I am providing the header file and source file of the basic Qt code (I am using QCustomPlot for plotting).
Header (mainwindow.h):
Source code (mainwindow.cpp):
I hope this helps! Let me know if you need further details.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now