Beispiel #1
0
int CVICALLBACK mask_folder (int panel, int control, int event,
							 void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:

			DirSelectPopup ("d:\\test", "Masks Folder", 1, 1, mask_path);
			SetCtrlVal (ERG_panel,ERG_panel_folder_path , mask_path);
			PopulateList();

			

			  
			  
			break;
	}
	return 0;
}
Beispiel #2
0
void acquire_scans (void)
{
	int color;
	int Nleft=0;
	char file [ FILENAME_MAX ];
	char filename[FILENAME_MAX];
	int data_file;

	SetCtrlAttribute (ERG_panel, ERG_panel_acquire, ATTR_DIMMED, 1);
	SetCtrlAttribute (ERG_panel, ERG_panel_abortscan, ATTR_DIMMED, 1);
	GetCtrlVal (ERG_panel, ERG_panel_nscans, &Nscans);

	DirSelectPopup ("d:\\data\\test", "Select Directory", 1, 1, pathname);

//acquire preambule
	strcpy(filename, pathname);
	sprintf(file, "\\scope_info.txt");
	strcat(filename, file);
	IO_output = fopen (filename, "w");
	wavepreamble();
	fclose(IO_output);

//acquire scaling coefficients
	strcpy(filename, pathname);
	sprintf(file, "\\scope_xinterval.txt");
	strcat(filename, file);
	IO_output = fopen (filename, "w");
	wavexinterval();
	fclose(IO_output);

	strcpy(filename, pathname);
	sprintf(file, "\\scope_yscaling.txt");
	strcat(filename, file);
	IO_output = fopen (filename, "w");
	waveyscaling();
	fclose(IO_output);

	strcpy(filename, pathname);
	sprintf(file, "\\scope_x0.txt");
	strcat(filename, file);
	IO_output = fopen (filename, "w");
	wavex0();
	fclose(IO_output);

	i=0;
	SetCtrlAttribute (ERG_panel, ERG_panel_pause, ATTR_DIMMED, 0);
	SetCtrlAttribute (ERG_panel, ERG_panel_abortscan, ATTR_DIMMED, 0);
	
// start trigger 
	SRS_flag=2;
	SRS_onoff();

// prepare file for intensity values, mask type and scan ref
	strcpy(filename, pathname);
	sprintf(file, "\\intensity.txt");
	strcat(filename, file);
	IO_intensity = fopen (filename, "w"); 
	
	 
	
//prepare file name for acquiring data
	while ( i < Nscans )
	{
		strcpy(filename, pathname);
		sprintf(file, "\\scope_data%d.txt", i);
		strcat(filename, file);

		data_file=OpenFile (filename, VAL_WRITE_ONLY, VAL_OPEN_AS_IS, VAL_BINARY);

		color=floor(256/Nscans)*i;
		waveform(color, data_file);
		
//the increment is done within the waveform function
		i++;

		Nleft=Nscans-i+1;
		SetCtrlVal (ERG_panel, ERG_panel_nremain, Nleft);
		ProcessSystemEvents();
		if (pause_flag)
		{
			while (pause_flag)
				ProcessSystemEvents();
		}
	}
	SetCtrlVal (ERG_panel, ERG_panel_nremain, 0);
	SetCtrlAttribute (ERG_panel, ERG_panel_pause, ATTR_DIMMED, 1);
	SetCtrlAttribute (ERG_panel, ERG_panel_abortscan, ATTR_DIMMED, 1);
	SetCtrlAttribute (ERG_panel, ERG_panel_acquire, ATTR_DIMMED, 0);
	
// stop trigger 	
	SRS_flag=0;
	SRS_onoff();

//clean buffer
	strcpy(filename, pathname);
	sprintf(file, "\\junk.txt");
	strcat(filename, file);
	IO_output = fopen (filename, "w");
	cleanbuffer();
	fclose(IO_output);

//close file 
	if (Nscans==0)
	{
	fclose(IO_intensity);
	}
	
	return;
}
Beispiel #3
0
void acquire_scans (void)
{
	int color;
	int Nleft=0;
	char file [ FILENAME_MAX ];

	SetCtrlAttribute (Main_pnl_handle, ERG_panel_acquire, ATTR_DIMMED, 1);
	SetCtrlAttribute (Main_pnl_handle, ERG_panel_abortscan, ATTR_DIMMED, 1);
	if (experiment==1){
		GetCtrlVal (Sequence_pnl_handle, Seq_panel_seq_number, &seq_num);
		Nscans=	seq_num*m;
	}
	else {
		GetCtrlVal (Main_pnl_handle, ERG_panel_nscans, &Nscans);
	}

	DirSelectPopup ("d:\\data\\test", "Select Directory", 1, 1, pathname);

	i=0;
	SetCtrlAttribute (Main_pnl_handle, ERG_panel_pause, ATTR_DIMMED, 0);
	SetCtrlAttribute (Main_pnl_handle, ERG_panel_abortscan, ATTR_DIMMED, 0);
	
// start trigger 
	SRS_flag=2;
	SRS_onoff();
	DeleteGraphPlot (Main_pnl_handle, ERG_panel_mask_display, -1, VAL_IMMEDIATE_DRAW);
	
	if (experiment==1){			 // mode sequence
		for (i=0;i<seq_num;i++) {
			for (h=0;h<m;h++){
				SetCtrlIndex (Sequence_pnl_handle, Seq_panel_mask_list, h);
				for (k=0;k<Npixel;k++){
					drive_level[k]=mask[h].voltages[k];
				}				
				display_masks();
				
				ProcessSystemEvents();
				GetLabelFromIndex (Sequence_pnl_handle, Seq_panel_mask_list, h, &mask_filename);
				strcpy(filename, pathname);
				
				//prepare file to write
				sprintf(file, "\\sequence%d_%s.txt", i, mask_filename);
				strcat(filename, file);
				data_file = OpenFile (filename, VAL_WRITE_ONLY, VAL_TRUNCATE, VAL_ASCII);
				
				//enable oscillo then wait for trigger and get ERG trace
				color=floor(256/Nscans)*(i*m+h);
				waveform(color, data_file);	
				get_intensity();
				
				//write header file
				headerfile();
				
				//write ERG trace 
				ArrayToFile (filename, data2fit, VAL_DOUBLE, 10000, 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_ROWS, VAL_SEP_BY_TAB, 100, VAL_ASCII, VAL_APPEND);
				nmeasure[0]=i*m+h+1;
				displaychannel();
				
				Nleft=Nscans-(i*m+h);
				SetCtrlVal (Main_pnl_handle, ERG_panel_nremain, Nleft);
				ProcessSystemEvents();
				if (pause_flag)
				{
					while (pause_flag)
						ProcessSystemEvents();
				}
			}
		}
	}
	
	else{				  // mode normal
	//prepare file name for acquiring data
		while ( i < Nscans )
		{
			strcpy(filename, pathname);
			sprintf(file, "\\scope_data%d.txt", i);
			strcat(filename, file);
			data_file = OpenFile (filename, VAL_WRITE_ONLY, VAL_TRUNCATE, VAL_ASCII);
			color=floor(256/Nscans)*i;
			waveform(color, data_file);
			get_intensity();
			
			headerfile();
			ArrayToFile (filename, data2fit, VAL_DOUBLE, 10000, 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_ROWS, VAL_SEP_BY_TAB, 100, VAL_ASCII, VAL_APPEND);
			
			i++;
			Nleft=Nscans-i+1;
			SetCtrlVal (Main_pnl_handle, ERG_panel_nremain, Nleft);
			ProcessSystemEvents();
			if (pause_flag)
			{
				while (pause_flag)
					ProcessSystemEvents();
			}
			CloseFile (data_file);
		}
	}
	
	SetCtrlVal (Main_pnl_handle, ERG_panel_nremain, 0);
	SetCtrlAttribute (Main_pnl_handle, ERG_panel_pause, ATTR_DIMMED, 1);
	SetCtrlAttribute (Main_pnl_handle, ERG_panel_abortscan, ATTR_DIMMED, 1);
	SetCtrlAttribute (Main_pnl_handle, ERG_panel_acquire, ATTR_DIMMED, 0);
	
// stop trigger 	
	SRS_flag=0;
	SRS_onoff();
	
	ibsic(device); 
	return;
}