Hello,
I'm a french student and I try to generate and acquire a signal with the Red Pitaya. The generation isn't a problem, but when I try to acquire a simple 40kHz sinusoidal I have a break in the acquisition. I tried to give a high priority to my .exe but there is no difference.
To illustrate the phenomena I give you the code and the data's chart.
There are two acquisitions
Here is the code, (another problem : the sampling rate seems not to be the value I wrote in the code, I haven't worked on this problem yet)
/* Set analog voltage on fast analog output */
#include <stdio.h>
#include <stdlib.h>
#include "/opt/redpitaya/include/redpitaya/rp.h"
#define RP_BUF_SIZE 16384
#define DATA_NBR 16384
//DECLARATION DES VARIABLES GLOBALES
int i1=0, i2=0;
float data_tab[DATA_NBR];
FILE *data_file = NULL;
//PROGRAMME PRINCIPAL
int main (int argc, char **argv) {
// Initialization of API
if (rp_Init() != RP_OK) {
fprintf(stderr, "Red Pitaya API init failed!\n");
return EXIT_FAILURE;
}
rp_AcqSetSamplingRate (RP_SMP_122_070K);
float* data = (float *)malloc(RP_BUF_SIZE * sizeof(float));
uint32_t bufferSize = RP_BUF_SIZE;
/* ouverture fichier*/
data_file = fopen("data.txt", "w");
if(data_file == NULL)
{
printf("Error opening file!\n");
}
rp_AcqStart();
rp_AcqGetDataPosV(RP_CH_1, 0,(RP_BUF_SIZE-1), data, &bufferSize);
for (i1; i1<DATA_NBR; i1++)
{
data_tab[i1] = *(data+i1);
}
for (i2; i2<DATA_NBR; i2++)
{
printf("Measured voltage on AI[1] %d = %fV\n", i2, data_tab[i2]);
fprintf(data_file, "%f\n", data_tab[i2]);
}
fclose(data_file);
free(data);
rp_Release();
return EXIT_SUCCESS;
}
[Issue] Simple data acquisition _ breaks in acquisitions
-
- Posts: 2
- Joined: Wed Apr 13, 2016 1:30 pm
-
- Posts: 1441
- Joined: Sat Jun 07, 2014 12:49 pm
- Location: Königswinter
Re: [Issue] Simple data acquisition _ breaks in acquisitions
Hi,
you read from the sample buffer while the scope is still recording into it. The disturbances occur when you are reading from regions where samples are currently being written into. Recording into the buffer only stops when the trigger delay expires after a trigger event happened.
If you want to continuosly read samples without triggering, you could observe the write pointer to determine where it is currently safe to read from. This is only feasible at sampling rates <= RP_SMP_1_953M.
you read from the sample buffer while the scope is still recording into it. The disturbances occur when you are reading from regions where samples are currently being written into. Recording into the buffer only stops when the trigger delay expires after a trigger event happened.
If you want to continuosly read samples without triggering, you could observe the write pointer to determine where it is currently safe to read from. This is only feasible at sampling rates <= RP_SMP_1_953M.
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie
Who is online
Users browsing this forum: No registered users and 71 guests