CAEN MCA  0.99.10
SDK for Hexagon
examples_waveforms.c

Wafevorms

#include "examples.h"
int32_t CAEN_MCA_EXAMPLES_EnableWaveforms(CAEN_MCA_HANDLE device, bool enabled) {
char *value = calloc(PARAMINFO_NAME_MAXLEN, sizeof(*value));
if (enabled)
strncpy(value, "TRUE", PARAMINFO_NAME_MAXLEN - 1);
else
strncpy(value, "FALSE", PARAMINFO_NAME_MAXLEN - 1);
// Error
fprintf(stderr, "%s(): failed. Error: '%"PRIi32"'.\n", __func__, ret);
}
free(value);
return ret;
}
int32_t CAEN_MCA_EXAMPLES_GetWaveforms(CAEN_MCA_HANDLE device, int32_t channel_id, int16_t *atrace1, int16_t *atrace2, uint8_t *dtrace1, uint8_t *dtrace2, uint32_t *len) {
int32_t ret = CAEN_MCA_RetCode_Success;
// To get the number of sample, we need the record length and the sample period
uint32_t length = 0;
// Get record length (in ns)
double rl;
// Get sample period (in ps)
uint32_t tsample_ps;
// Get waveforms
channel,
atrace1,
atrace2,
dtrace1,
dtrace2
);
// Error
fprintf(stderr, "%s(): failed. Error: '%"PRIi32"'.\n", __func__, ret);
}
else {
length = (uint32_t)rl * 1000 / tsample_ps;
}
if (len != NULL) *len = length;
return ret;
}