Exemple #1
0
void test::loadSequenceFile() {
	set_trigger_interval(0, 0.001);
	load_sequence_file(0, "U:\\AWG-Edison\\Ramsey\\Ramsey-BBNAPS1.h5");
	for (int ch = 0; ch < 4; ch++ ) {
		set_channel_enabled(0, ch, 1);
	}
	set_run_mode(0, 0, 1);
	set_run_mode(0, 2, 1);
}
Exemple #2
0
void test::streaming() {
	set_trigger_interval(0, 0.001);
//	set_trigger_source(0, 1);
	load_sequence_file(0, "U:\\APS\\Ramsey-Streaming.h5");
	set_channel_enabled(0, 0, 1);
	set_run_mode(0, 0, 1);
	run(0);
	usleep(10000000);
	stop(0);
}
Exemple #3
0
static char *rmode_cmd(void * arg)
{
    int *argp;
    int rv;
    
    argp = (int *)(arg);
    rv = set_run_mode(*argp);
    if ( rv < 0 ) {
	return "could not set run mode";
    }
    return NULL;
}    
int main(int argc, char* argv[])
{

	print_title("BBN APS2 Sequence Player");

	argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present
	option::Stats	stats(usage, argc, argv);
	option::Option *options = new option::Option[stats.options_max];
	option::Option *buffer = new option::Option[stats.buffer_max];
	option::Parser parse(usage, argc, argv, options, buffer);

	if (parse.error())
	 return -1;

	if (options[HELP] || argc == 0) {
		option::printUsage(std::cout, usage);
		return 0;
	}

	for (option::Option* opt = options[UNKNOWN]; opt; opt = opt->next())
	 std::cout << "Unknown option: " << opt->name << "\n";

	for (int i = 0; i < parse.nonOptionsCount(); ++i)
	 std::cout << "Non-option #" << i << ": " << parse.nonOption(i) << "\n";

	//Logging level
	TLogLevel logLevel = logINFO;
	if (options[LOG_LEVEL]) {
		logLevel = TLogLevel(atoi(options[LOG_LEVEL].arg));
	}

	//Trigger source -- default of internal
	APS2_TRIGGER_SOURCE triggerSource = INTERNAL;
	if (options[TRIG_MODE]) {
		triggerSource = APS2_TRIGGER_SOURCE(atoi(options[TRIG_MODE].arg));
	}
	set_logging_level(logLevel);
	set_log("stdout");

	//Trigger interval -- default of 10ms
	double trigInterval = 10e-3;
	if (options[TRIG_INTERVAL]) {
		trigInterval = atof(options[TRIG_INTERVAL].arg);
	}

	string seqFile;
	if (options[SEQ_FILE]){
		seqFile = string(options[SEQ_FILE].arg);
	} else {
		std::cerr << "A sequence file is required.";
		return -1;
	}

	string deviceSerial = get_device_id();
	if (deviceSerial.empty()){
		cout << concol::RED << "No APS2 devices connected! Exiting..." << concol::RESET << endl;
		return 0;
	}

	connect_APS(deviceSerial.c_str());

	double uptime;
	get_uptime(deviceSerial.c_str(), &uptime);

	cout << concol::CYAN << "Uptime for device " << deviceSerial << " is " << uptime << " seconds" << concol::RESET << endl;

	// force initialize device
	init_APS(deviceSerial.c_str(), 1);

	//load the sequence file
	load_sequence_file(deviceSerial.c_str(), seqFile.c_str());

	//Set the trigger mode
	set_trigger_source(deviceSerial.c_str(), triggerSource);

	//Trigger interval
	set_trigger_interval(deviceSerial.c_str(), trigInterval);

	//Set to sequence mode
	set_run_mode(deviceSerial.c_str(), RUN_SEQUENCE);

	run(deviceSerial.c_str());

	//For software trigger, trigger on key stroke
	if (triggerSource == 2) {
		cout << concol::YELLOW << "Press t-Return to trigger or q-Return to exit" << concol::RESET << endl;
		while(true) {
			char keyStroke = cin.get();
			if (keyStroke == 't') {
				trigger(deviceSerial.c_str());
			} else if (keyStroke == 'q') {
				break;
			}
		}
	}
	else {
		cout << concol::YELLOW << "Press any key to stop" << concol::RESET;
		cin.get();
	}


	stop(deviceSerial.c_str());
	disconnect_APS(deviceSerial.c_str());

	delete[] options;
	delete[] buffer;
	return 0;
 }