[time-nuts] SR620: odd measurements when in remote control

lincoln lincoln at ampmonkeys.com
Wed Dec 21 16:39:50 EST 2016

	I have an SR620 that i am trying to get some more life out of. I have dedicated a raspberry pi 2 to recode data and make the files available through the network. I wrote a small c deamond that will setup the counter to make frequency measurements and  save the result to a file on the flash card. 

Overall it is basically working but.... on start up i have an odd behavior. 

My file format is a "two column " file, column 1 is elapsed system time in seconds,  and column 2 is the measurement returned by the counter.  When the program starts I get 2 to 5 measurements that are wrong. A number of measurement are returned in the first second, 

How I setup the counter: 
		// get id of counter, if it is not an sr620, exit with error;
		fprintf(stream,"*RST\n");  // system reset
		fprintf(stream,"CLCK 1\n"); // external timebase
		fprintf(stream,"AUTM 0\n"); // automatic masurment off
		fprintf(stream,"MODE 3\n"); // mesure freqency
		fprintf(stream,"GATE1 E1\n"); // set for 10 second gate
		fprintf(stream,"SIZE 1\n");    // 1 sample per mesurment
		fprintf(stream,"TERM 1, 0\n"); // 50 ohm termination for channel "A"
		fprintf(stream,"LEVL 1, 0\n"); // trigger level 0.00
		fprintf(stream,"TCPL 1, 1\n"); // AC coupling, channel A
		// pause for a bit

		loop until quite {
			fprintf(stream,"STRT;*WAI;XAVG?\n"); // start measurement, wait till complete, 
			while ((bytesread = getline(from serial port stream) != -1) { // will block until full line 
				if (bytesread >10) break;
			// write data to file,

		// close serial port
		// close data file

example output:
0, 1.999999881895E+07
0, 1.999999881912E+07
0, 1.999999881757E+07
7, 1.999999881856E+07
17, 1.999999881878E+07
27, 1.999999881900E+07
37, 1.999999881877E+07
47, 1.999999881908E+07
57, 1.999999881921E+07

What do you think?


More information about the time-nuts mailing list