HP VXI 75000 C Series User's And Scpi Programming Manual page 421

Algorithmic closed loop controller
Table of Contents

Advertisement

* you execute this program as "<progname> lang1 lang2 lang3 ..."
*/
alg_num = 1;
while (argc > alg_num) {
algorithm = get_algorithm(argv[alg_num]); /* Read the algorithm */
/* Define the algorithm */
{
char
(void) sprintf(alg, "ALG%d", alg_num);
INST_SEND(e1415, "alg:def %S,%*B\n", alg,
/* Check for algorithm errors */
INST_QUERY(e1415,"syst:err?\n", "%d,%S", &error, string);
if (error) {
}
}
/* Free the malloc'ed memory */
free(algorithm);
alg_num++;
}
(void) printf("All %d algorithm(s) loaded without errors\n\n", alg_num-1);
#else /* Download algorithm with in-line code */
algorithm = " \n"
"/* Example algorithm uses Custom Functions.\n"
" * This algorithms generates a triangle and\n"
" * sine wave signal to separate current outputs.\n"
" */\n"
"\n"
" static float inc = .1, x=0, gain=2*1.57;\n"
" if ( x > 1.57 ) inc = -inc;\n"
" if ( x < -1.57 ) inc = abs(inc);\n"
" x = x + inc;\n"
" O100 = x * ( .001 ); \n"
" O101 = gain * sin( x ) * ( .001 );\n"
" \n";
INST_SEND(e1415, "alg:def 'ALG1',%*B\n", strlen(algorithm) + 1, algorithm);
#endif
/* Preset Algorithm variables */
/* Initiate Trigger System - start scanning and running algorithms */
INST_SEND(e1415,"init\n");
/* This example shows no data retrieval. */
#if 1 /* Set to 1 if using User interactive commands to E1415 */
/* Call this function if you want to be able to type SCPI commands and
* see their responses. NOTE: switch to FORM,ASC to retrieve
Appendix G
/* Starting algorithm number */
alg[6];
/* Temporary algorithm name */
strlen(algorithm) + 1, algorithm);
(void) printf("While loading file %s, syst:err %d,%s\n",
argv[alg_num], error, string);
exit(1);
/* Next algorithm */
Example Program Listings
421

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents