
Programming Examples
for ( int i = 0; i < nSetSize; i++ )
if ( 0 == strncmp(s, Set[i], nSLen) && nSLen == strlen(Set[i]) ) {
return i;
}
return -1;
}
// Parse command line. Format:
// <Executable> USB|GPIB[:<Address>] [<Pacing>] [<Meas Func>]
// [<RefFreq>] [<Delta>]
bool ParseCmdArgs(CmdArgs *pArgs, int argc, char* argv[]) {
static char const *StrInterfaces[] = { "USB", "GPIB" };
static char const *StrMeasFuncs[] =
{
"PER",
"PER:BTB",
"FREQ:BTB" // <-nFirstFreq
};
static int const nFirstFreq = 2;
static int const nMeasFuncs = sizeof(StrMeasFuncs) / sizeof(StrMeasFuncs[0]);
// defaults
static int const DefAddr = 10;
static double const DefPacing = 100e-6; // s
static int const DefMeasFunc = 2;
static double const DefRefFreq = 10e6; // Hz
static double const DefDelta = 10e5; // Hz
// assign some defaults
pArgs->bUSB = true;
pArgs->nAddr = DefAddr;
pArgs->Pacing = DefPacing;
strcpy(pArgs->Func, StrMeasFuncs[DefMeasFunc]);
pArgs->bPeriod = (DefMeasFunc < nFirstFreq);
pArgs->RefFreq = DefRefFreq;
pArgs->Delta = DefDelta;
// parse command line
bool bError = (argc < 2); // at least interface should be
// speci
fi
ed
for ( int i = 1, nArg = i; ! bError && i < argc; i++, nArg++ ) {
char const *s = argv[i];
switch (nArg)
{
case 1: { // interface
//
fi
nd ':' delimiter
int j = 0;
for ( j = 0; 0 != s[j] && ':' != s[j]; j++ );
// check interface and read address (if any)
int const nInterface = CheckStr(s, j, StrInterfaces, 2);
if ( nInterface < 0 ) { bError = true; break; }
FCA3000, FCA3100, MCA3000 Series Programmer Manual
4-13
Содержание FCA3000 Series
Страница 2: ......
Страница 8: ...Preface iv FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 9: ...Getting Started ...
Страница 10: ......
Страница 14: ...Using the USB Interface 1 4 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 15: ...Syntax and Commands ...
Страница 16: ......
Страница 26: ...Command Syntax 2 10 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 135: ...Status and Events ...
Страница 136: ......
Страница 156: ...Status and Events 3 20 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 157: ...Programming Examples ...
Страница 158: ......
Страница 179: ...Appendices ...
Страница 180: ......
Страница 181: ...Appendix A Character Set FCA3000 FCA3100 MCA3000 Series Programmer Manual A 1 ...
Страница 182: ...Appendix A Character Set A 2 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Страница 188: ...Appendix D Reserved Words D 2 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...