📄 sampling2.c
字号:
/**************************************************************//* *//* Program Name : sampling2 *//* *//* Version: 0.00 2002-05-26 *//* 1.00 2002-10-04 *//* *//* Copyright (c) 2002 T.Kondo/CRL All Right Reserved *//* *//**************************************************************//* 俬俹亅倁俴俛俬 僆僼儔僀儞僒儞僾儕儞僌僾儘僌儔儉 乮帪崗僙僢僩偼暿偺僜僼僩偱峴偆) by T.Kondo 2001.8.17 2002.5.26 2002.9.15 侾昩偛偲偺僨乕僞惗惉傪捛壛 2002.10.04 Ver 1.0 release 憱傜偣曽 sampling2 span sfreq adbit numch [filename [tempdir [mode]]] 偙偙偱 span 廂廤帪娫乮昩乯 sfreq 僒儞僾儕儞僌廃攇悢 40,100,200,500 (kHz) 1,2,4,8,16 (MHz) adbit 俙俢暘夝擻乮價僢僩) 1,2,4,8 numch 僠儍僱儖悢 1 傑偨偼 4 filename -- 僨乕僞僼傽僀儖柤 僨僼僅儖僩偼tds.data tempdir -- 侾昩僨乕僞僼傽僀儖僨傿儗僋僩儕 僨僼僅儖僩偼僇儗儞僩僨傿儗僩儕 mode -- 僼傽僀儖弌椡儌乕僪 1: 堦妵僼傽僀儖偺傒 乮僨僼僅儖僩乯 2: 侾昩僨乕僞僼傽僀儖偺傒 3: 堦妵僼傽僀儖亄侾昩偛偲僼傽僀儖摨帪 4: 侾昩僨乕僞僼傽僀儖弌椡丄娤應屻堦妵僼傽僀儖嶌惉 6: 侾昩僨乕僞僼傽僀儖偺傒 (帪娫惂尷柍偟乯 7: 俇偲摨偠乮偨偩偟僼傽僀儖弌椡柍偟乯僔僗僥儉僠僃僢僋梡*/#include <stdio.h>#include <errno.h>#include <fcntl.h>#include <unistd.h>#include <sys/stat.h>#include <math.h>#ifdef linux#include <sys/time.h>#else#include <time.h>#endif#include <sys/tdsio.h>#include "libipvlbi.h" // IP-VLBI梡娭悢孮(by T.Kondo)#include "libipvlbi_board.h" // IP-VLBI僒儞僾儔乕儃乕僪梡娭悢孮(by T.Kondo)int main(int argc, char **argv){ char outfile[80]; char* dflt_fname="tds.data"; char* dflt_tempdir="./"; char outdir[60]; int i,rv, mode; int span, sfreq, adbit, numch; if(argc < 3){ printf("Sampling2 Ver 1.00 (c) 2002 T.Kondo/CRL\n"); printf("Usage: sampling2 span sfreq adbit numch [filename [tempdir [mode]]]\n"); printf("\n"); printf(" where span ---- duration (sec)\n"); printf(" sfreq ---- sampling frequency\n"); printf(" 40,100,200,500 (for kHz)\n"); printf(" 1,2,4,8,16 (for MHz)\n"); printf(" adbit ---- A/D bit\n"); printf(" 1,2,4,8\n"); printf(" default is 1\n"); printf(" numch ---- number of channel\n"); printf(" 1,4\n"); printf(" default is 1\n"); printf(" filename ---- out file name\n"); printf(" default is tds.data\n"); printf(" tempdir ---- every 1sec data out directory\n"); printf(" default is current directory\n"); printf(" mode ---- File out mode\n"); printf(" 1: One big file only (default)\n"); printf(" 2: Every 1 sec file only\n"); printf(" 3: One big file + Every 1 sec file (simultaneously)\n"); printf(" 4: Every 1 sec file, after Obs one big file created\n"); printf(" 5: 3 + 4 for debug purpose (debug.dat will be created)\n"); printf(" 6: Every 1 sec file out only but no time limitation"); printf(" (continuous running with ring file buffer (max 10 files)\n"); printf(" 7: same as 6 but no file out (performance check purpose)\n"); exit(0); } span = atoi(*(argv + 1 )); sfreq= atoi(*(argv + 2 )); if (argc>=4) { adbit = atoi(*(argv + 3 )); } else { adbit=1; } if (argc>=5) { numch = atoi(*(argv + 4 )); } else { numch=1; } if (argc>=6) { strcpy(outfile,*(argv+5)); } else { strcpy(outfile,dflt_fname); } if (argc>=7){ strcpy(outdir,*(argv+6)); } else { strcpy(outdir,dflt_tempdir); } /* check out dir name accompanied by "/" or not */ i=strlen(outdir); //printf("i= %d\n",i); if(outdir[i-1] != '/') { outdir[i]='/'; outdir[i+1]='\0'; } if (argc>=8) { mode = atoi(*(argv + 7 )); } else { mode=1; } printf(" span = %d\n",span); // debug printf(" sfreq = %d\n",sfreq); // debug printf(" adbit = %d\n",adbit); // debug printf(" numch = %d\n",numch); // debug printf(" outfile = %s\n",outfile); // debug //rv=sampleget(outfile, span, sfreq, adbit, numch); //rv=sampleget2(outfile, span, sfreq, adbit, numch, outdir, mode);// rv=sampleget3(outfile, span, sfreq, adbit, numch, outdir, mode); rv=sampleget4(outfile, span, sfreq, adbit, numch, outdir, mode); if(mode==1 || mode==3 || mode==4) { printf("Data File is %s\n",outfile); } if(mode==2 || mode==3 || mode==4) { printf("1sec Data out directory is %s\n",outdir); } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -