本文整理汇总了C++中Measurement::GetLengthBeforeTrigger方法的典型用法代码示例。如果您正苦于以下问题:C++ Measurement::GetLengthBeforeTrigger方法的具体用法?C++ Measurement::GetLengthBeforeTrigger怎么用?C++ Measurement::GetLengthBeforeTrigger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Measurement
的用法示例。
在下文中一共展示了Measurement::GetLengthBeforeTrigger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if(f == NULL) {
throw("Unable to open file with metadata.\n");
}
fprintf(f, "command: ");
for(i=0; i<argc; i++) {
fprintf(f, " %s", argv[i]);
}
fprintf(f, "\n");
fprintf(f, "timestamp: %d-%02d-%02d %02d:%02d:%02d\n\n",
current->tm_year+1900, current->tm_mon+1, current->tm_mday,
current->tm_hour, current->tm_min, current->tm_sec);
fprintf(f, "channels: ");
for(i=0; i<PICOSCOPE_N_CHANNELS; i++) {
if(ch[i]->IsEnabled()) {
fprintf(f, "%c", 'A'+i);
}
}
fprintf(f, "\n");
fprintf(f, "length: %ld\n", x.GetLength());
fprintf(f, "samples: %ld\n", x.GetNTraces());
// fprintf(f, "unit_x: %.1lf ns | %.1lf ns\n", meas->GetTimebaseInNs(), meas->GetReportedTimebaseInNs());
tmp_dbl = meas->GetTimebaseInNs();
fprintf(f, "unit_x: %.1lf ns\n", tmp_dbl);
fprintf(f, "range_x: %.1lf ns\n", x.GetLength()*tmp_dbl);
tmp_dbl = x.GetVoltageDouble();
fprintf(f, "unit_y: %.10le V\n", tmp_dbl*3.0757874015748e-5); // 1/(127*256) actually, but this might have to be fixed for series 4000
fprintf(f, "range_y: %g V\n", tmp_dbl);
if(x.GetNTraces() > 1) {
if(x.IsTriggered()) {
fprintf(f, "trigger_ch: %c\n", (char)(meas->GetTrigger()->GetChannel()->GetIndex()+'A'));
// fprintf(f, "trigger_xfrac: %g\n", meas->GetTrigger()->GetXFraction());
// fprintf(f, "trigger_yfrac: %g\n", meas->GetTrigger()->GetYFraction());
fprintf(f, "trigger_dx: %d (%g %% of %ld)\n", meas->GetLengthBeforeTrigger(), meas->GetLengthBeforeTrigger()*100.0/x.GetLength(), x.GetLength());
tmp_short = meas->GetTrigger()->GetThreshold();
tmp_dbl = meas->GetTrigger()->GetYFraction();
fprintf(f, "trigger_dy: %g V (%d)\n", meas->GetTrigger()->GetThresholdInVolts() /*tmp_dbl*x.GetVoltageDouble()*/, tmp_short);
}
}
// fprintf(f, "unit_x: %.1lf ns | %.1lf ns\n", meas->GetTimebaseInNs(), meas->GetReportedTimebaseInNs());
fprintf(f, "out_bin: %s\n", x.IsBinaryOutput() ? "yes" : "no");
fprintf(f, "out_dat: %s\n", x.IsTextOutput() ? "yes" : "no");
// triggered (TODO: we could also ask for a single triggered event)
if(x.GetNTraces() > 1) {
unsigned int run=0;
for(run=0; run<x.GetNRepeats() && !_kbhit(); run++) {
//FILE_LOG(logINFO) << "Running experiment nr. " << run+1;
if(run>0) {
cerr << "\nRepeat #" << run+1 << endl;
meas->RunBlock();
}
while(meas->GetNextDataBulk() > 0) {
for(i=0; i<PICOSCOPE_N_CHANNELS; i++) {
if(ch[i]->IsEnabled()) {
if(x.IsTextOutput()) {
meas->WriteDataTxt(ft[i], i); // zero for channel A
}
if(x.IsBinaryOutput()) {
meas->WriteDataBin(fb[i], i); // zero for channel A
}
}
}
}
}