当前位置: 首页>>代码示例>>C++>>正文


C++ Measurement::WriteDataBin方法代码示例

本文整理汇总了C++中Measurement::WriteDataBin方法的典型用法代码示例。如果您正苦于以下问题:C++ Measurement::WriteDataBin方法的具体用法?C++ Measurement::WriteDataBin怎么用?C++ Measurement::WriteDataBin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Measurement的用法示例。


在下文中一共展示了Measurement::WriteDataBin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........

			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
								}
							}
						}
					}
				}
				if(run>1) {
					fprintf(f, "repeats:    %u\n", run);
				}
				// tmp_dbl = meas->GetRatePerSecond();
				// fprintf(f, "\nrate:       \n");
				// if(fabs(tmp_dbl) > 1e6) {
				// 	fprintf(f, "%.3f MS/s\n", tmp_dbl*1e-6);
				// } else if(fabs(tmp_dbl) > 1e3) {
				// 	fprintf(f, "%.3f kS/s\n", tmp_dbl*1e-3);
				// } else {
				// 	fprintf(f, "%f S/s\n", tmp_dbl);
				// }
			} else {
				unsigned int run=0;
				for(run=0; run<x.GetNRepeats() && !_kbhit(); run++) {
					if(run>0) {
						cerr << "\nRepeat #" << run+1 << endl;
						meas->RunBlock();
					}
					while(meas->GetNextData() > 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
开发者ID:enascimento,项目名称:picoscope,代码行数:67,代码来源:run_picoscope.cpp


注:本文中的Measurement::WriteDataBin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。